Apache mod_rewrite rule help
I am trying to write a number of apache rewrite rules, seems like the regex are not matching
This is what needs to be done Code:
OLD -> NEW Code:
RewriteEngine On |
Hi,
You don't need the starting and the trailing slashes in the URL that's to be rewritten. So try this: Code:
RewriteEngine On |
Quote:
I forgot to mention, it is a virtualhost, would that matter? |
Quote:
Did you clear your browser cache? Are you using the rewrite stuff from a .htaccess file, or from the apache config file? And it doesn't matter if it's a virtual host of not. |
Not working =
http://www.example.com/source/aus-nz not changing to http://www.example.com/source/aus-nz The rewrite rules are not taking any effect. Browser cache? Cleared (also using Ctrl+F5 to force a proper refresh) Rewrite rules are in the apache config file |
Quote:
And since it's a vhost, you need to put those directives inside the vhost's definition section inside the <Directory ...>...</Directory> where you define the DocumentRoot directory of the vhost. E.g. Code:
<VirtualHost *:80> |
I finally did it. Our setup is a bit complicated. The requests to the set of apache hosts come through a hardware load balancer depending on the URL, the this rewrite again passes the requests to the LB which again forwards it to another set of apache hosts based on the URL. And to complicate matters there is a third party apache module. This is what I ended up with
Code:
RewriteRule ^/source/aus-nz(.*) http://www.example.com/source-code/australia-nz$1 [R,L] |
All times are GMT -5. The time now is 11:58 PM. |