how to test mod rewrites on local apache instance?
am 30.11.2007 13:16:15 von sqad
Hi,
I want to be able to test out apache redirections and rewrite rules
from the mod_rewrite module from my local box:
I have apache config file with:
Listen 127.0.0.1:80
ServerName 127.0.0.1
Redirect /issues/issue?id=(\d+) http://www.google.com
When I go into the browser to the URL:
http://localhost/issues/issue?id=10
I also get an error in the apache logs saying it's searching for the
'issues' file in the htdocs directory...that's not what I want! The
Redirect rule didn't get picked up which I am not sure why :-(
Please, any help? I have only one shot at testing out complex rewrites
on a non-live site and I'd like to do that from my local box before I
push this to production apache servers to pick up the redirection when
we switch dns's from the old domain.
Help :-(
/sqad
Re: how to test mod rewrites on local apache instance?
am 01.12.2007 11:47:21 von shimmyshack
On Nov 30, 12:16 pm, sqad wrote:
> Hi,
>
> I want to be able to test out apache redirections and rewrite rules
> from the mod_rewrite module from my local box:
>
> I have apache config file with:
> Listen 127.0.0.1:80
> ServerName 127.0.0.1
> Redirect /issues/issue?id=(\d+)http://www.google.com
>
> When I go into the browser to the URL:http://localhost/issues/issue?id=10
>
> I also get an error in the apache logs saying it's searching for the
> 'issues' file in the htdocs directory...that's not what I want! The
> Redirect rule didn't get picked up which I am not sure why :-(
>
> Please, any help? I have only one shot at testing out complex rewrites
> on a non-live site and I'd like to do that from my local box before I
> push this to production apache servers to pick up the redirection when
> we switch dns's from the old domain.
>
> Help :-(
>
> /sqad
you really do need to rt*m I'm afraid, it's a great starting point an
you shouldn't be running a web server at all unless you do this:
you are using mod_alias not mod_rewrite:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html
if you decide to change to mod_rewrite then you can use additional
logging to debug your redirection.
you dont say what version of apache you are using but I hope its 2 or
2.2:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
there are examples here of debugging:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewrit elog