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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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? |
|
|||
|
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) |
|
|||
|
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. |