This is my .htaccess file and working fine. What I want If any one try to browse the site without www , this have the capability to redirect the url with www. Example:- if someone try to browse with http://mydomain.com/theater/city/123 then this will be redirect to http://www.mydomain.com/theater/city/123 My current .htaccess file below. Options +FollowSymLinks Options -MultiViews RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteRule \.(gif|jpg)$ - [F] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^city/(.*)/(.*)$ index.php?city=$1&page=$2 RewriteCond %{QUERY_STRING} !page RewriteRule ^city/(.*)$ index.php?city=$1 [L] RewriteRule ^cinemas/(.*)/(.*)/(.*)$ theater.php?thid=$3&cityname=$1 [L] RewriteRule ^cinemas-new/(.*)/(.*)/(.*)$ theater-new.php?thid=$3&cityname=$1 [L] RewriteRule ^sitemap.xml(.*)$ sitemap.php [L] Code (markup): Thanks in advance I really require this.
# force www. start RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L] # force www. stop Code (markup):
Here it goes Options +FollowSymLinks Options -MultiViews RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] RewriteCond %{HTTP_REFERER} !^$ RewriteRule \.(gif|jpg)$ - [F] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^city/(.*)/(.*)$ index.php?city=$1&page=$2 RewriteCond %{QUERY_STRING} !page RewriteRule ^city/(.*)$ index.php?city=$1 [L] RewriteRule ^cinemas/(.*)/(.*)/(.*)$ theater.php?thid=$3&cityname=$1 [L] RewriteRule ^cinemas-new/(.*)/(.*)/(.*)$ theater-new.php?thid=$3&cityname=$1 [L] RewriteRule ^sitemap.xml(.*)$ sitemap.php [L] Code (markup):