Looking through apache.org and a other couple forums, I’ve put together the code that is listed below for my .htaccess file. Since I’m just a beginner at putting together an .htaccess file, can anyone see any issues with the code? I’ve listed the functions of this code below.
1. Redirects non-www. to www.
2. Redirects www.example.com/index.html to the root (www.example.com)
3. Take all 404 Errors to the custom error page
CODE
RewriteEngine on RewriteCond %{HTTP_HOST} !^www.example.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]/)index.html(\?[^\ ])?\ HTTP/ RewriteRule ^(([^/]/)*)index.html$ http://www.example.com/$1 [R=301,L]
ErrorDocument 404 /Errors/404.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]/)index.html(\?[^\ ])?\ HTTP/ RewriteRule ^(([^/]/)*)index.html$ http://www.example.com/$1 [R=301,L]
ErrorDocument 404 /Errors/404.html
Thank you for your help,
TeamSDA_Christian








