Currently my Url is: http://www.domain.co.uk/index.php/city/details/city-name
I would like to change it to:
http://www.city-name.domain.co.uk/index.php/city/details/city-name
or:
Currently my Url is: http://www.domain.co.uk/index.php/city/details/city-name
I would like to change it to:
http://www.city-name.domain.co.uk/index.php/city/details/city-name
or:
Put the .htaccess file into the http ://www.domain.co.uk/ document root
To http ://www.city-name.domain.co.uk/index.php/city/details/city-name
RewriteRule ^(.*)/([^/]+)$ http://www.$2.domain.co.uk/$1/$2 [R=301,L] To http ://www.city-name.domain.co.uk/index.php/city/details/city-name
RewriteRule ^index.php/(.*)/([^/]+)$ http://www.$2.domain.co.uk/$1/$2 [R=301,L] If the server is the same, set above RewriteRule this line to prevent redirection loop
RewriteCond %{HTTP_HOST} !^www\.(.*).domain\.co\.uk [NC] File content example
<ifModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.(.*).domain\.co\.uk [NC] RewriteRule ^index.php/(.*)/([^/]+)$ http://www.$2.domain.co.uk/$1/$2 [R=301,L] </IfModule> To exclude domain.co.uk (whitout www)
<ifModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.(.*).domain\.co\.uk [NC] RewriteCond %{HTTP_HOST} !^domain\.co\.uk [NC] RewriteRule ^index.php/(.*)/([^/]+)$ http://www.$2.domain.co.uk/$1/$2 [R=301,L] </IfModule>