My Site's every pages has Different URL with Seo variable, on page click URL becomes
index.php?seo=home
rates.php?seo=rates
reservation.php?seo=reservation
now i want to convert the URL to this
agnow.us/rates
agnow.us/information
agnow.us/reservation
Here is my .htaccess file.
Options +SymLinksIfOwnerMatch -Multiviews
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+rates\.php\?seo=([^\s&]+) [NC]
RewriteRule ^ /%1? [L,R=301]
RewriteRule ^/(.*)$ rates.php?seo=$1 [L,NC,QSA]
You can use this code in your root .htaccess:
Options +SymLinksIfOwnerMatch -Multiviews
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+rates\.php\?seo=([^\s&]+) [NC]
RewriteRule ^ /%1? [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ rates.php?seo=$1 [L,NC,QSA]
Related
i want to change my url through .htaccess here is all code i am trying.
i write 2 codes for same page, in second page i am adding mode varible but it is showing me like this :
free/english-lession/learn-about-influential-people&mode=advanced
Options -Indexes
<IfModule mod_rewrite.c>
Options +MultiViews
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /page\?type=(.*)&lang=(.*)&id=(.*)\ HTTP
RewriteRule ^ /page/%2/%3/%4\? [R,L]
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /page\?type=(.*)&lang=(.*)&id=(.*)&mode=(.*)\ HTTP
RewriteRule ^ /page/%2/%3/%4/%5\? [R,L]
</IfModule>
I'm trying to append to wordpress an additional parameter into my URL.
For example, I have the URL: http://example.com
I want to change that to URL: http://example.com/this-example/
I'm thinking I can do this is in htaccess along the lines of a rewrite condition, but i'm unsure how to go about this. This is what I was thinking here.
Htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine on
RewriteRule ^/this-example/(.*)/ /index.php?$1 [L]
</IfModule>
Options -Indexes
You can try this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{THE_REQUEST} !^/this-example [NC]
# use your own host here, for me is 192.68.10.10
RewriteCond %{HTTP_HOST} 192\.168\.10\.10$ [NC]
RewriteRule !^this-example/ /this-example%{REQUEST_URI} [L,R,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^this-example/(.*)$ $1 [L,QSA]
</IfModule>
Options -Indexes
How can I Hide index.php and rewriting URL parameters
http:example.com/www/index.php?page=admin&action=login
as
http:example.com/www/admin/login
I have hide index.php using the code mentioned below (Helped from URL) which makes URL as:
http:example.com/www/?page=admin&action=login
My htaccess file code
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]
But I need like this:
http:example.com/www/admin/login
If any body knows, that will be a great help.Thank you
You can use these rules in /www/.htaccess:
DirectoryIndex index.php
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /www/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?page=$1&action=$2 [L,QSA]
RewriteRule ^(.+)$ index.php?$1 [L,QSA]
I have a URL like this
www.subdomain.mydomain.com/mydir/admin/index.php?page=dashboard
I want to have a user friendly url like this
www.subdomain.mydomain.com/mydir/admin/dashboard
How do I achieve this? I am trying with the below mentioned code. What am I doing wrong here?
Options -MultiViews
# URL rewriting module activation
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$
RewriteRule .* - [F]
RewriteBase /
Options +FollowSymLinks
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?page=$1 [L]
For a similar context please refer this question.
Try this .htaccess:
Options +FollowSymLinks -MultiViews
RewriteEngine on
# use appropriate rewrite base
RewriteBase /mydir/admin/
RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$
RewriteRule ^ - [F]
RewriteCond %{THE_REQUEST} /index\.php\?page=([\w-]+) [NC]
RewriteRule ^ %1? [L,R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ index.php?page=$1 [L,QSA]
i am trying to convert the actual URL to user friendly there is dynamic menu, when user click on page the orignal url becomes
http://example.com/single.php?name=mypagename
i want to change it to
http://example.com/page/mypagename
here is my htaccess file i tried from different angles Please can any one help to correct it..
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymlinks -Multiviews
Options +SymLinksIfOwnerMatch -Multiviews
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^(GET|HEAD|POST)\ /single\.php(\?|\ )
RewriteCond %{QUERY_STRING} name=(.+)
RewriteRule page/(.*) single.php?name=$1
RewriteRule ^ /page/%1? [L,R=301]
You must rearrange your directives:
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymlinks -Multiviews
Options +SymLinksIfOwnerMatch -Multiviews
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+single\.php\?name=([^\s&]+) [NC]
RewriteRule ^ /page/%1? [L,R=301]
RewriteRule ^page/(.*)$ single.php?name=$1 [L,NC,QSA]
RewriteCond %{THE_REQUEST} \s/+(Web/2015/wessexcars)/internalpage\.php?seo=\?name=([^\s&]+) [NC]
RewriteRule ^ %1/%2? [L,R=301]
RewriteRule ^(Web/2015/wessexcars)/(.+?)/?$ $1/internalpage.php?seo=$1 [L,NC,QSA]
Try like bellow,
RewriteEngine on
RewriteRule ^/page/([a-zA-Z-0-9-]+)$ $1/single.php?name=$2 [NC]
firstly change your config file make index file blank
$config['index_page'] = '';
and make a htaccess file
<ifmodule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</ifmodule>