Mod_Rewrite question.

Associate
Joined
27 Jun 2006
Posts
1,473
Evening all - fairly new to this, but I have the following file stucture on some webspace (helping a friend, not my site or structure!)

public_html (www.domain.com)
|
|___directory1
|
|___directory2

At the moment, the htaccess file has the following lines in it to push all requests to the domain name to directory1. IE: www.domain.com ->www.domain.com/directory1

This worked fine until he added directory 2.

Now if he browses to www.domain.com/directory2 firefox throws an error:

"Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

which I am guessing is something to do with the htaccess file.

I am no master on htaccess but I tried the following but it still doesn't work:

Code:
Options +FollowSymLinks
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC] 
RewriteRule (.*) http://www.domain.com/directory1/$1 [R=301,L]


Any help kindly accepted :)
 
I don't really know why it has to be done in the htaccess file, I foolishly thought I would give a friend a hand (if only I knew it was the voodoo that is rewrite I would have run away!)

I may try to push him the way you suggested as its easier and I understand it!

Cheers
 
Thanks for that - no other htaccess anywhere (I had a good look as I was pulling my hair out!)

In the end I persuaded him to dump the htaccess and go with a PHP redirect, so its now happy (and a lot easier for me!!)
 
Back
Top Bottom