Url Rewriting Problem

This is a discussion on Url Rewriting Problem within the Apache Web Server forums, part of the Web Server and Related Forums category; I have been using URL rewriting for a while to direct requests to missing pages to a php script rather ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-26-2006
ken@smallboxsoftware.net
 
Posts: n/a
Default Url Rewriting Problem

I have been using URL rewriting for a while to direct requests to
missing pages to a php script rather than a 404 error.

DirectoryIndex index.php
RewriteEngine on
RewriteCond /var/www/smallbox/www.mysite.com/web/%{REQUEST_FILENAME}
!-f
RewriteRule ^/(.+) /scripts/page.php

This set of rules works great when running mod_php but for some reason
fails on servers configured to use CGI. Does anyone know how I would
need to modify this rule in order for it to work with CGI?

  #2 (permalink)  
Old 06-26-2006
foobat
 
Posts: n/a
Default Re: Url Rewriting Problem

The ErrorDocument directive would work perfectly if it didn't change
the URL. Unforunately the end user needs to be unaware that they have
been shifted to another page.

Davide Bianchi wrote:
> On 2006-06-26, ken@smallboxsoftware.net <ken@smallboxsoftware.net> wrote:
> > I have been using URL rewriting for a while to direct requests to
> > missing pages to a php script rather than a 404 error.

>
> Why don't you use the ErrorDocument directive instead?
> Davide
>
> --
> One morning I shot an elephant in my pajamas. How he got into my pajamas
> I'll never know.
> -- Julius Henry "Groucho" Marx (http://en.wikiquote.org/wiki/Groucho_Marx)


  #3 (permalink)  
Old 06-26-2006
foobat
 
Posts: n/a
Default Re: Url Rewriting Problem


Davide Bianchi wrote:
> On 2006-06-26, foobat <ken@smallboxsoftware.net> wrote:
> > The ErrorDocument directive would work perfectly if it didn't change
> > the URL. Unforunately the end user needs to be unaware that they have
> > been shifted to another page.

>
> Don't top post please, is one of the most annoying thing on the usenet.
> Well, even if your rewrite rule worked it too would have changed the URL,
> so I don't really see the difference. Anyway, what do you mean with
> "it doesn't work"? Is the rewrite module used at all or what? And how is
> it the rule in the cgi-based machine (because you posted the php one)?


As mentioned eariler my rewrite rule works perfectly in the way I need
it to with mod_php. The file that is being if I go to
www.foo.bar/foo.php that is what the user sees in their browser not
www.foo.bar/scripts/page.php


In terms of the error I am getting, there appears to be some sort of
loop going on.

hp/php/php/php/php/php/php/php/php/php/index.php
[Sun Jun 25 17:09:26 2006] [debug]
/home/adconrad/build/apache2/security/sarge/apache2-2.0.
54/build-tree/apache2/server/core.c(2749): [client 192.168.2.1]
redirected from r->uri = /p
hp/php/php/php/php/php/php/php/index.php
[Sun Jun 25 17:09:26 2006] [debug]
/home/adconrad/build/apache2/security/sarge/apache2-2.0.
54/build-tree/apache2/server/core.c(2749): [client 192.168.2.1]
redirected from r->uri = /p
hp/php/php/php/php/php/index.php
[Sun Jun 25 17:09:26 2006] [debug]
/home/adconrad/build/apache2/security/sarge/apache2-2.0.
54/build-tree/apache2/server/core.c(2749): [client 192.168.2.1]
redirected from r->uri = /p
hp/php/php/php/index.php
[Sun Jun 25 17:09:26 2006] [debug]
/home/adconrad/build/apache2/security/sarge/apache2-2.0.
54/build-tree/apache2/server/core.c(2749): [client 192.168.2.1]
redirected from r->uri = /p
hp/php/index.php

Here is my ScriptAlias Directive:

ScriptAlias /php/ "/var/www/smallbox/www.mysite.com/cgi/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php"

Any help here would be greatly appreciated.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:03 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0