homepage Welcome to WebmasterWorld Guest from
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

mod_rewrite $1 not carrying last /

10+ Year Member

Msg#: 2949 posted 10:40 pm on Feb 24, 2005 (gmt 0)

i'm redirecting calls to an old directory to a new directory... here's the ruleset that i'm using...

#handle moving requests for /files4 to /files2 since moving files on F: to G:
RewriteRule files4/(.*) http://www.example.com/files2/$1[R=301,L]

when the original request comes in as /files2/foo/ i get two redirects in my logfile... one to /files4/foo and then a second to /files4/foo/ because foo is a directory and there should have been a trailing / anyway... so, why doesn't $1 or (.*) carry that training slash when it is there in the original request?



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

Msg#: 2949 posted 3:30 pm on Feb 25, 2005 (gmt 0)

This sounds a lot like another recent post [webmasterworld.com], and my answer would be the same: Some other code in httpd.conf or .htaccess is interfering.

Also, check to be sure that UseCanonicalName is Off, or that you have specified a correct canonical name.

I suppose that content negotiation could also be interfering; Disable it unless you need it (using Options -Multiviews in .htaccess if you don't have httpd.conf access).



10+ Year Member

Msg#: 2949 posted 11:56 pm on Feb 25, 2005 (gmt 0)


yeah, i had read that thread and it does seem kinda similar... the reason i didn't jump in on that one is that the situations are exactly backwards... i'll have to go checking and see what's up... i don't think it is anything in .htaccess on my system, though... i don't have any code there to do that type of stuff, that i know of... however, it could be something with mod_spelling or such... i don't recall my canocial names setting... not sure i have one set but i do use multiviews for various things...

at this time, it is a mystery... but it won't be for long as those old urls are removed from the search engines... after some more months, i'll be removing that redirect code and won't have that problem any more...

oh well... i thought that it might be something easy that i wasn't aware of WRT (.*) and $1 usages and such...

[aside: glad to see you still here! i see you've moved up in the ranks a bit, too... congrats on the mod status ;)]

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