homepage Welcome to WebmasterWorld Guest from 54.166.62.226
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
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

10+ Year Member



 
Msg#: 83 posted 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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 83 posted 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

10+ Year Member



 
Msg#: 83 posted 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

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



 
Msg#: 83 posted 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

10+ Year Member



 
Msg#: 83 posted 4:33 am on Dec 23, 2002 (gmt 0)

THANK YOU JIM!

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

jdMorgan

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



 
Msg#: 83 posted 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved