rewrite_mod RewriteRule problem

rewrite_mod RewriteRule problem

Posted by: wiglaf
Posted on: 2008-01-08 19:55:00

I'm new when it comes to using rewrite_mod on apache, and I seem to be having a problem that should be easy to figure out, but I have no idea what's going on.

I'm in a directory mysite.com/ and I want to rewrite all requests for a sub-directory to a php script. So mysite.com/subdir gets rewritten to mysite.com/script.php?var=subdir

What I came up with is this (assume RewriteEngine on):

rewriteRule ^(.*) /script.php?var=$1 [L]

But that returns a 500 internal error. What's weird is if I try

rewriteRule ^test/(.*) /script.php?var=$1 [L]

and give the server a request for mysite.com/test/subdir it works. Why does it work for one and not the other? Thanks.

Re: rewrite_mod RewriteRule problem

Posted by: Atropos7
Posted on: 2008-01-08 21:04:00

In reply to:

rewriteRule ^(.*) /script.php?var=$1 [L]

But that returns a 500 internal error.


Iteration - From Wikipedia, the free encyclopedia



cool openvein.org -//-

Re: rewrite_mod RewriteRule problem

Posted by: wiglaf
Posted on: 2008-01-09 18:40:00

RewritCond $1 !^script.php$
RewriteRule (.*) /script.php?var=$1 [L]

Tags: script phptest scriptinternal errorphp scriptapachescript phptest scriptinternal errorphp scriptapache