I am not a coder, so I am hoping someone can check over what I am about to do (found a variety of code online and got some from Hostgator) I want to redirect my www domain name to the non www I also want to redirect the /index.htm page to non , though probably less important This is the code I want to put in the .htaccess file: RewriteCond %{HTTP_HOST} ^www.mydomain.com$ RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L] AND RewriteCond %{THE_REQUEST} ^.*mydomain.com/index.htm\ HTTP/ RewriteRule ^(.*)mydomain.com/index.htm$ /$1 [R=301,L] Do I need the following stuff? and if so do I need to change anything? RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301,QSA,L] Thanks!
Try: RewriteCond %{HTTP_HOST} ^www.mydomain.com$ RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L] RewriteCond %{REQUEST_URI} ^/index.htm$ RewriteRule ^(.*)$ http://mydomain.com/ [R=301,L]
What about the Rewrite Engine On, etc? Does anyone know how the 'redirect' in the General settings panel of Wordpress affects or interacts with the htacess file? I would be having them say the same thing, but since wordpress 'redircts' I cannot see a way to test the code I put in htacces file.
Does anyone know this? Do I need the following stuff? and if so do I need to change anything? RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301,QSA,L]