homepage Welcome to WebmasterWorld Guest from 54.204.215.209
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
RewriteRule Problem
Please help
iJeep




msg:1522441
 7:55 pm on Dec 21, 2002 (gmt 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

 

DaveAtIFG




msg:1522442
 3:21 pm on Dec 22, 2002 (gmt 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.

iJeep




msg:1522443
 3:37 am on Dec 23, 2002 (gmt 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.

jdMorgan




msg:1522444
 4:01 am on Dec 23, 2002 (gmt 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

iJeep




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

THANK YOU JIM!

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

jdMorgan




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

iJeep,

Glad it helped!

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved