I'm using a .htaccess code that change the url (add 'www.' in non-www urls) but my problem is when entering /subfolder in url , .htaccess redirect doesn't work right.
Example
I enter this url: mydomain.com/demo/ it redirects to: www.mydomain.com (without /demo)
any idea?
Here is my .htaccess code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Maybe this?
# Enforce www # If you have subdomains, you can add them to # the list using the "|" (OR) regex operator RewriteCond %{HTTP_HOST} !^(www|local|admin) [NC] RewriteRule ^(.*)$ http://www.yourdomainhere.com/$1 [L,R=301]