I want to redirect all inner url to non-www in following .htaccess How to do it ? RewriteEngine On RewriteRule ^([^/]*)/([^/]*)\/$ /game.php?id=$1&title=$2 [L] RewriteRule ^([^/]*)\/$ /index.php?page=$1 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)\/$ /category.php?cid=$1&page=$2&title=$3 [L] RewriteRule ^sitemap.xml$ sitemap.php [L] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] Code (markup):
You want to direct all URLs with www to non-www? I see no https, so maybe something like this will work: RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.yoursite\.tld [NC] RewriteRule ^(.*)$ http://yoursite.tld/$1 [L,R=301] Code (markup): Replacing "yoursite" and "tld" with the domain and .com or whatever you are using.
Generic rule: RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] RewriteRule ^(.*) http://%1/$1 [R=301,NE,L] Code (ApacheConf):