Welcome to WebmasterWorld Guest from 54.160.131.144

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod_Rewrite double add per-dir prefix problem

     

Brett_Tabke

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

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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)

.htaccess:

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...;-)

littleman

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

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



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.

littleman

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

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



or not.

Brett_Tabke

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

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

littleman

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

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



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

Brett_Tabke

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

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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).

DaveAtIFG

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

WebmasterWorld Senior Member 10+ Year Member



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]

littleman

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

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



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

Puffin

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

10+ Year Member



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

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

tnx

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

mark_roach

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

10+ Year Member



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.

Puffin

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

10+ Year Member



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.

mark_roach

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

10+ Year Member



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.

Unix

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

Windows

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

Brett_Tabke

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

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

Puffin

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

10+ Year Member



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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month