Hello I have a main domain that have instabuilder setup on and when creating a page with instabuilding it creates it as "maindomain.com/pagename"
The problem I'm having is with my addon domain when I create a page with instabuilder it creates the link as addondomain.com/index.php/pagename Why is the index.php coming up, the link doesn't look nice.
Any help would be much appreciated. Thank you
This is the code you can use in your .htaccess (under DOCUMENT_ROOT) to remove index.php from URI:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ %1 [R=301,L]
copy from
Remove 'index.php' from URL with .htaccess
Related
I am just new to .htaccess.
I need some rewrite rules for URLs.
I Google'd some and applied but no change in URL.
I want:
demo.example.com/section.php?id=1
Changed to:
demo.example.com/section/sample-section
i tried
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^section/(\d+)*$ ./section.php?id=$1
but no difference
Thanks.
I will appreciate your help.
First, make sure mod_rewrite is enabled and htaccess files allowed in your Apache configuration.
Then, put this code in your htaccess (which has to be in root folder)
Options -MultiViews
RewriteEngine On
# redirect "/section.php?id=xxx" to "/section/xxx"
RewriteCond %{THE_REQUEST} \s/section\.php\?id=([0-9]+)\s [NC]
RewriteRule ^ /section/%1? [R=301,L]
# internally rewrite "/section/xxx" to "/section.php?id=xxx"
RewriteRule ^section/([0-9]+)$ /section.php?id=$1 [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^section/([^/]+)$ /section.php?id=$1 [L]
This will turn example.com/section.php?id=X to example.com/section/X
I suggest storing the URI in a database then using section.php?uri=
For example:
example.com/section.php?uri=super-awesome
would turn into:
example.com/section/super-awesome
I want to redirect my site to friendly.
I have my website pull data from database and adress is /post?id=1
and i want to change it to /post/1
I already wrote the code for rewrite but i cant make sense from google research how to redirect to /post/1.
my code
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^post/([^/.]+)/?$ post.php?id=$1 [L]
Use:
Options +FollowSymLinks
RewriteEngine on
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+post\.php\?id=([^\s&]+) [NC]
RewriteRule ^ /post/%1? [R=301,L,NE]
# internal forward from pretty URL to actual one
RewriteRule ^post/([^/.]+)/?$ post.php?id=$1 [L,QSA,NC]
This one worked for me
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ post.php?id=$1 [NC]
if you goto url /post/check1/
the htaccess file internally call post?id=check1
I want to hide "index.php" from "www.blahblah.com/index.php"? How to do that?
Please help, I've tons of codes now i'm planning to hide index.php from URL. I googled and found that you first need to create .htaccess file. But i don't know where to start it? and Should i need to create that file along with my projects? And what to type inside that file?
create .htaccess file then copy the code below
change 'project_folder_name' of the folder of your project
if your project is in the root folder just put '/'
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project_folder_name
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
I have been working on an .htaccess file. The url I started with was, www.example.com/index.php?page=pagetitle. I want the Link to only show www.example.com/pagetitle.
So far the only thing in my .htaccess file removes the index.php.
Options -MultiViews
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.(php|html?)
RewriteRule ^ /%1 [R=301,L]
Any help would be greatly appreciated, I sadly don't have the knowledge to create these codes on my own.
Thank you in advance.
I will also be editing this question as I figure more of this out, from support of other people etc.
You can try these rules:
Options -MultiViews
RewriteEngine on
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?page=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=302,L]
# internal forward from pretty URL to actual one
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ index.php?page=$1 [L,QSA]
I want to make my first api, but im having trouble setting up the urls. The api url is here:
http://tools.fifaguide.com/api/
So for example if some one goes to:
http://tools.fifaguide.com/api/player/messi
Then I need this page to be loaded:
http://tools.fifaguide.com/api/server.php
What do I write in .htaccess? and where should I put it?
This is what I have right now:
RewriteEngine On
RewriteRule ^api http://tools.fifaguide.com/api/server.php
But it doesnt do anything, also the htacces file is in the api folder.
Any help would be really apreciated!
This is what ended up working for me
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/api/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ api/index.php [QSA,L]
////// wordpress stuff /////////
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
You might try this:
RewriteEngine On
RewriteRule ^api/(.*) http://tools.fifaguide.com/api/server.php [R,L]
And if you need the resulting url you could add this:
RewriteEngine On
RewriteRule ^api/(.*) http://tools.fifaguide.com/api/server.php?r=$1 [R,L]
Then in your script you could access the requested url with $_GET["r"] (assuming php...)
Also a helpful tool i've found for htaccess:
http://htaccess.madewithlove.be/
-Ken