Solved

Redirect index.html to index.php with 301 redirect in .htaccess

Posted on 2007-04-10
2
2,019 Views
Last Modified: 2008-01-09
I have a 301 redirect for my old index page to the new php one like this:

redirect 301 /index.html http://www.mydomain.com/index.php

What I don't like is that when someone goes to http://www.mydomain.com, it appends the index.php to the end of it where it didn't use to before. Does anyone know how to setup the redirect so that when someone goes to http://www.mydomain.com, all they see in the address bar is http://www.mydomain.com instead of http://www.mydomain.com/index.php? Thanks.
0
Comment
Question by:rbichon
2 Comments
 
LVL 4

Accepted Solution

by:
ftsao earned 500 total points
Comment Utility
Try deleting the index.html file off the server and use the following:

redirect 301 /index.html http://www.mydomain.com

With the redirect rule in your .htaccess file, there shouldn't be a need to keep the old html file.
0
 
LVL 1

Author Comment

by:rbichon
Comment Utility
I tried that. It causes an infinite loop and the page never loads. It seems like the server thinks that it has to redirect a page back to itself. Here is what I did:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$ [NC]
RewriteRule ^(.*)index.html$ / [L,R=301]

I verified it and it works. Thanks for your help though.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now