Solved

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

Posted on 2007-04-10
2
2,046 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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hosting application in Apache and Tomcat 1 123
file path 14 72
Updating PHP in Windows Server 2012 r2 22 281
Apache timeout remote connection if not port 80 10 98
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

730 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