I'm using a .htaccess file to force all 'example.com' requests to 'www.example.com'
The problem is, now I'd like to develop my website locally on my machine, and I'm using a custom host defined as example.local -- that points to my version of the website on my local MAMP stack.
#force non-www to www.example.com
R开发者_如何学JAVAewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
How can i modify this htaccess file to not push my example.local requests to www.example.com?
Add a second condition to your rewrite rule
#force non-www to www.example.com
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteCond %{HTTP_HOST} !^example.local$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
精彩评论