Solved

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

Posted on 2007-04-10
2
2,032 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
ID: 18884764
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
ID: 18884903
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 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