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 double add per-dir prefix problem

 3:50 am on Jun 19, 2001 (gmt 0)

Anyone recognize this error? It seems I am getting a double apply of the per-dir path prefix. I've tried it every which way with the RewriteBase option and no luck. (this is my first foray with mod rewrite under windows - same thing appears to work ok on *nix)


RewriteEngine on
RewriteBase /foo/forum1/
RewriteRule ^page\.html$ page.cgi [T=application/x-httpd-cgi]

A request too www.foo.com/forum1/page.html results in:

Rewrite log:

www.foo.com - - [18/Jun/2001:22:44:58 -0500] [www.foo.com/sid#66b054][rid#725998/initial] (3) [per-dir c:/foo/forum1/] strip per-dir prefix: c:/foo/forum1/page.html -> page.html
www.foo.com - - [18/Jun/2001:22:44:58 -0500] [www.foo.com/sid#66b054][rid#725998/initial] (3) [per-dir c:/foo/forum1/] applying pattern '^page\.html$' to uri 'page.html'
www.foo.com - - [18/Jun/2001:22:44:58 -0500] [www.foo.com/sid#66b054][rid#725998/initial] (2) [per-dir c:/foo/forum1/] rewrite page.html -> page.cgi
www.foo.com - - [18/Jun/2001:22:44:58 -0500] [www.foo.com/sid#66b054][rid#725998/initial] (3) [per-dir c:/foo/forum1/] add per-dir prefix: page.cgi -> c:/foo/forum1/page.cgi
www.foo.com - - [18/Jun/2001:22:44:58 -0500] [www.foo.com/sid#66b054][rid#725998/initial] (3) [per-dir c:/foo/forum1/] add per-dir prefix: c:/foo/forum1/page.cgi -> c:/foo/forum1/c:/foo/forum1/page.cgi
www.foo.com - - [18/Jun/2001:22:44:58 -0500] [www.foo.com/sid#66b054][rid#725998/initial] (2) [per-dir c:/foo/forum1/] remember c:/foo/forum1/c:/foo/forum1/page.cgi to have MIME-type 'application/x-httpd-cgi'

To show that it actual works under unix, try [webmasterworld.com...] will call page.cgi and print hello.
Have a peek at the index [webmasterworld.com...] to see that there is no tricks...;-)



 4:49 am on Jun 19, 2001 (gmt 0)

I've also used something similar on *nix many times without any problem The first thing that hit me about your error log is that the slashes are going the wrong way. This makes me think that it might be a mod_rewrite mapping problem.


 4:54 am on Jun 19, 2001 (gmt 0)

or not.


 4:56 am on Jun 19, 2001 (gmt 0)

I bolded the error portion so it stood out a bit more in the log lines above.


 5:18 am on Jun 19, 2001 (gmt 0)

Try this:
RewriteEngine on
RewriteBase /foo/forum1/
RewriteRule ^/page\.html$ page.cgi [T=application/x-httpd-cgi]


 8:28 am on Jun 19, 2001 (gmt 0)

Not it either. I did just installed the newest version too. Must be something in my config file. I don't see anything that would want to do further substitutions (no aliases other than cgi-bin at all).


 12:49 pm on Jun 19, 2001 (gmt 0)

If it's the last rule in the grouping try adding the [L] parameter as in
RewriteRule ^page\.html$ page.cgi [T=application/x-httpd-cgi] [L]


 5:30 pm on Jun 19, 2001 (gmt 0)

Did you try it without 'RewriteBase /foo/forum1/' ? Perhaps it is causing a duplication of server paths?


 2:07 pm on Oct 26, 2001 (gmt 0)

Let's bring this old topic to the top again.

I have the same annoying problem! Did you find a solution to this problem???


(edited by: Puffin at 2:33 pm (gmt) on Oct. 26, 2001)


 2:21 pm on Oct 26, 2001 (gmt 0)

Welcome to WMW Puffin.

I have successfully used mod rewrite ok under windows to do something similar.

I have not got the exact solution to hand but I think that you need to include c:\ in the rewrite base directive.


 2:40 pm on Oct 26, 2001 (gmt 0)

Nope, does not make any difference. I did not use a rewrite base. The .htaccess file I am using is the same I use on on a linux server and there it works perfectly.


 9:44 pm on Oct 26, 2001 (gmt 0)

Sorry about that, must be my memory playing tricks with me. The only difference I have between my UNIX and windows versions is that I fully qualify the path to the cgi in the windows environment.


RewriteRule ^(.*)\.html$ ../cgi-bin/kennel.cgi?id=$1 [T=application/x-httpd


RewriteRule ^(.*)\.html$ /localchampdogs/cgi-bin/kennel.cgi?id=$1 [T=application/x-httpd-cgi]


 7:18 am on Oct 27, 2001 (gmt 0)

I fixed it by adding absolute drive paths to my conf file for the root dir of each domain.


 5:24 pm on Oct 28, 2001 (gmt 0)

Tnx, Brett and Mark. (and others of course)

I've found it! A slash did the trick.

RewriteRule ^pagina/([0-9]+) /pageview.php?pageid=$1

instead of

RewriteRule ^pagina/([0-9]+) pageview.php?pageid=$1

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