|
|
Redirect Question
|
|
|
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
My .htaccess file includes a section that looks like this (Note: domain names have been changed to protect the innocent):
Code:
# Permanently Moved
Redirect 301 /index.html http://www.mydomain.com/index.php
Redirect 301 /index.htm http://www.mydomain.com/index.php
The trouble with this is that when someone enters http://www.mydomain.com, they are automatically redirected to http://www.mydomain.com/index.php (and that's what shows up in their browser's address bar). Largely for aesthetic reasons, I'd rather do this instead:
Code:
# Permanently Moved
Redirect 301 /index.html http://www.mydomain.com/
Redirect 301 /index.htm http://www.mydomain.com/
Unfortunately, I think the latter code results in a bad loop. Any solutions to this dilemma? I really prefer everything to result in http:/www.mydomain.com showing up in the user's address bar no matter what. It just looks cleaner to me. I have old links to index.htm and index.html that I would love to have resolve to the root directory of the website.
(
Last edited by selowitch; Aug 5, 2006 at 05:35 PM.
)
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status:
Offline
|
|
the latter code shouldn't result in a bad loop if your DirectoryIndex (the default file to read in a directory) is index.php
What if you choose your second bit of code and also put this in the .htaccess:
DirectoryIndex index.php
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
Originally Posted by registered_user
What if you choose your second bit of code and also put this in the .htaccess:
DirectoryIndex index.php
Hey, thanks, Regis. That worked great!
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Mar 2001
Location: CO
Status:
Offline
|
|
I delete the index.htm and index.html files from server -- they trump index.php without resetting directoryindex. When they're missing: index.php rises to top.
|
TOMBSTONE: "He's trashed his last preferences"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|