Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Redirect Question

Redirect Question
Thread Tools
selowitch
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status: Offline
Reply With Quote
Aug 5, 2006, 05:08 PM
 
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. )
     
registered_user
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status: Offline
Reply With Quote
Aug 5, 2006, 07:37 PM
 
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
     
selowitch  (op)
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status: Offline
Reply With Quote
Aug 5, 2006, 10:36 PM
 
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!
     
Love Calm Quiet
Mac Elite
Join Date: Mar 2001
Location: CO
Status: Offline
Reply With Quote
Aug 8, 2006, 08:59 AM
 
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"
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:04 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,