Solved

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

Posted on 2007-04-10
2
2,062 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

705 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