Can someone help me with the correct content to put into a new .htaccess file to accomplish this: 1) Rewrite http://www.example.com/folder/index.php to http://www.example.com/folder/ (permanent) 2) Rewrite http://example.com/folder/ to http://www.example.com/folder/ (permanent) Also, I need to put this .htaccess file in the "folder", correct? (rather than the http://www.example.com main directory).
Try this one in "folder" RewriteEngine on RewriteRule ^index\.php$ http://www.example.com/folder/ [R=301,L] RewriteCond %{http_host} ^example\.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC,L] Code (markup):
Thanks much for the reply and info. The http://www.example.com/folder/index.php to http://www.example.com/folder/ worked perfectly. However, the http://example.com/folder/ to http://www.example.com/folder/ did not seem to work...
Use the following for 2nd condition RewriteCond %{http_host} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/folder/$1 [R=301,NC,L] Code (markup):