Forum Moderators: phranque

Message Too Old, No Replies

Redirect home.html causes a Redirection loop?

         

Major Disaster

8:46 pm on May 10, 2008 (gmt 0)

10+ Year Member



Hello,

I had an old website that had a landing page (index.html), that users then clicked enter to get to the homepage (home.html).

Ive since made a new site (on the same domain) and want to redirect home.html to the site root (ie www.domain.com)

However, applying:

Redirect 301 /home.html [domain.com...]

Causes a redirection loop, but

Redirect 301 /home.html [domain.com...]

Does not...?

I understand why a redirection loop would be caused if i did:

Redirect 301 /index.html [domain.com...]

But dont get why it happens with home.html

I can post my .htaccess file if it helps to see it.

Thanks for any help.

Receptional Andy

8:52 pm on May 10, 2008 (gmt 0)



It sounds like home.html might be set as a directory index page via the DirectoryIndex directive.

I don't know if there's a mechanism to remove entries, but you could try adding

DirectoryIndex index.php
and seeing if that helps.

Added: and welcome to WebmasterWorld, Major Disaster!

[edited by: Receptional_Andy at 8:52 pm (utc) on May 10, 2008]

Major Disaster

9:01 pm on May 10, 2008 (gmt 0)

10+ Year Member



Wow.

Within 6 minutes i got a friendly greeting and an answer that solved my question. What a forum!

If you didnt guess, adding "DirectoryIndex index.php" solved my problem!

Cheers for the help. Much appreciated.

EDIT: With that ive realised i can also redirect my "old" index.html to the siteroot.

Once again, thanks.

[edited by: Major_Disaster at 9:03 pm (utc) on May 10, 2008]

g1smd

9:06 pm on May 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This might work:

# Redirect Index Files, in root or in folders, at (www.)domain.eu, to be Folder-Based URLs with trailing slash, at www.domain.eu, and Strip Parameters:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*(index多ome)\.(html?如hp地spx?).*\ HTTP/
RewriteRule ^(([^/]*/)*)(index多ome)\.(html?如hp地spx?)$ http://www.domain.eu/$1? [R=301,L]