- Code: Select all
# Direct all traffic to domain.com
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]
The trouble is I now develop on a local server before uploading to my remote server, and the above redirect is obviously causing problems when I try to view the local version. The local server is on a NAS server and is accessed via http://devserver/sitename/
Is there any way I can use the same .htaccess on both the local and remote versions of the site, with the redirect only working on the remote version? Maybe another condition to check that the HTTP_HOST doesn't include "devserver" before redirecting?