WordPress Redirecting Index.html to WordPress Root Domain
WordPress Redirecting Index.html to WordPress Root Domain
Quick code snippet for you this afternoon. We recently re-designed a website for a company that previously utilized a separate mobile site. In doing so it was important to create 301 redirects for the mobile URLs to the new responsive WordPress site that was created in its place. The mobile site homepage was located at index.html, pretty standard. I figured I would simply add a basic redirect:
Redirect 301 /index.html http://www.yourwebsite.com
Uh oh, redirect error!
This webpage has a redirect loop.
The webpage at http://www.—.com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
After a little bit of troubleshooting, I came up with a simple resolution. For anybody else who experiences this issue, here is the proper .htaccess redirect:
RewriteCond %{THE_REQUEST} ^.*/index.html RewriteRule ^(.*)index.html$ http://www.yourwebsite.com/$1 [R=301,L]
Comments:
Share Your Thoughts