Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

RewriteRule Problem

Please help

     
7:55 pm on Dec 21, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Nov 30, 2002
posts:225
votes: 0


I have been working on this part of my .htaccess file all day. It should be simple, but just won't work:
RewriteBase /
RewriteCond %{HTTP_HOST} ^widgetsupply\.com [NC]
RewriteRule ^/(.*) /widgetsupply/ [L]

I am trying to rewrite all requests for [widgetsupply.com...] to the widgetsupply/ directory. My other domain (widgetssupply.com) uses the root directory, but I need them to share pictures and databases.

With the code above it pulls the files from the root directory. If I take out some of the slashes I get unspeakable errors.

TIA,
Kevin

3:21 pm on Dec 22, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 21, 1999
posts:2141
votes: 0


If I correctly understand what you're trying to do, you're pretty close!

I think amending your rule to:


RewriteRule ^(.*) http://widgetsupply.com/widgetsupply/$1 [L]
will accomplish what you're after.

Hopefully, the true experts will refine this a bit for us if necessary.

3:37 am on Dec 23, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Nov 30, 2002
posts:225
votes: 0


I have tried that too. I get a forbidden message:
Forbidden
You don't have permission to access /widgetsupply/widgetsupply/widgetsupply/...yougetthepicture.../widgetsupply/widgetsupply/ on this server.
4:01 am on Dec 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


iJeep,
You're having a recursion problem.

Use another RewriteCond to make sure that the rule will not be applied to anything but requests for the domain, and not for subdirectories.

Something like this might work:


RewriteCond %{HTTP_HOST} ^widgetsupply\.com [NC]
RewriteCond %{REQUEST_URI} !/widgetsupply/ [NC]
RewriteRule ^(.*) /widgetsupply/$1 [L]

Jim
4:33 am on Dec 23, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Nov 30, 2002
posts:225
votes: 0


THANK YOU JIM!

You just made the (website)world a better place! ;-)

5:00 am on Dec 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


iJeep,

Glad it helped!

Jim