my mod-rewrite does odd things!

Discuss practical ways rearrange URLs using mod_rewrite.

Postby snowball » Sat Sep 15, 2001 3:13 am

Hi

I've been trying to use the virtual user hosts feature of mod-rewrite:

I want to make:

http://www.arnold.outuk.com

find a page which is at

http://www.outuk.com/webspace/arnold/index.html

("arnold" is one of loads of different user names - currently just a page under construction)

The best code i've used so far is :

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.[^.]+.outuk.com$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^www.([^.]+).outuk.com(.*) /webspace/$1/$2/index.html

which I have placed in a .htaccess file in the http://www.outuk.com directory.

It gives me an error message:

Forbidden

You don't have permission to access

/webspace/arnold/webspace/arnold/webspace/arnold/webspace/arnold/webspace/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/index.html/arnold/webspace/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/index.html/index.html/arnold/webspace/arnold/webspace/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/index.html/arnold/webspace/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/arnold/webspace/arnold/index.html/index.html/index.html/index.html/arnold/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html


on this server.

Apache/1.3.19 Server at http://www.arnold.outuk.com Port 80



Why does it keep repeating - It's almost correct if you take the first bit and the last !

Any help or ideas would be much appreciated.

Snow
snowball
 
Posts: 2
Joined: Fri Sep 14, 2001 4:00 pm

Postby Brett » Wed Sep 26, 2001 11:54 am

It looks to me like it will keep repeating because there are no conditions on your second "RewriteRule" statement.

One way to fix this: Add a RewriteCond statement of the form
RewriteCond %{REQUEST_URI} !^/webspace/

Another way: In your webspace directory, include an .htaccess file with the statement RewriteEngine off
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com

Postby snowball » Sun Sep 30, 2001 1:41 pm

Well thanks Brett .... it worked great (the second method with extra .htaccess file).

Solved it straight away.

Much appreciated.

Regards

Snow
snowball
 
Posts: 2
Joined: Fri Sep 14, 2001 4:00 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 7 guests

cron