Reputation: 11
My site is not loading properly. For some reason when I put the htaccess code mentioned below, my site home page loads without any style or image. and when delete .htaccess from my server the site loads perfectly but shows .html on URL.
Here is the error I get:
ERR_TOO_MANY_REDIRECTS
I can't seem to figure it out. I'm not a htaccess guy :(
Would really appreciate any kind of help
Here is the htaccess code:
AddType text/html .shtml .shtm .htm .html
AddHandler server-parsed .shtml .shtm .htm .html
Options Indexes FollowSymLinks Includes
-line is commented- Uncomment the version of PHP you have on your server
-line is commented- Only one of the following can be uncommented
-line is commented-AddHandler application/x-httpd-php5 .shtml
AddHandler application/x-httpd-php52 .shtml
-line is commented-AddHandler application/x-httpd-php54 .shtml
-line is commented-AddHandler application/x-httpd-php56 .shtml
-line is commented-AddHandler application/x-httpd-php4 .shtml
RewriteOptions inherit
RewriteEngine On
Options +Indexes
-line is commented- for going with SSL
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mysite[dot]com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*)/(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.php$ /$1 [L,R=301]
-line is commented- others
RewriteCond %{HTTP_HOST} ^mysite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
RewriteRule ^terms$ "http\:\/\/mysite\.com\/\/about\-terms" [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^contact\.html\/?(.*)$
"https\:\/\/mysite\.com\/contact_captcha\.html$1" [R=301,L]
Upvotes: 0
Views: 160
Reputation: 20745
You are testing with permanent redirects. Never do this, as this causes weird unreproducable bugs, even after changing the rule that was wrong.
You have a rule that makes no sense whatsoever:
RewriteCond %{REQUEST_URI} ^(.*)/(.*)$
RewriteRule . %1/%2 [R=301,L]
This is an infinite loop that redirects over and over to the same page. As it is unclear to me what you want to accomplish with this rule, just delete it. Then delete your cache in your browser, close the browser and reopen it. This should clear the cached redirect.
Upvotes: 2