.htaccess removing www only from live site
Is it possible to conditionally include the rewriterule that removes www
from a URL only on a live site? I have site.dev and staging.site.com and
site.com setup but I only want to have one .htaccess file to keep track
of. Currently my .htaccess looks like this:
RewriteEngine On
# remove index.php
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# remove www
# RewriteCond %{http_host} ^www\.site\.com [NC]
# RewriteRule ^(.*)$ http://site.com/$1 [R=301,NC]
on site.dev and staging.site.com. I uncomment the last two lines in
site.com. If I leave the two lines uncommented on site.dev it redirects me
to site.com.
No comments:
Post a Comment