Forum Moderators: phranque
I am using httpd.conf with Apache 1.3 on linux.
The first rewrite rule works correctly so that I can enter /show_job.cgi/j/nnn where nnn is an id number. This displays correctly as show_job.cgi?j=nnn.
RewriteEngine On
RewriteRule ^/show_job.cgi/j/([0-9]+) /show_job.cgi?j=$1 [R]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /show_job\.cgi\?j=$1\ HTTP/
RewriteRule ^show_job\.cgi$ http://www.example.com/j/?1 [R=301,L]
I want the RewriteCond and second RewriteRule to force /show_job.cgi?j=nnn to display as /show_job.cgi/j/nnn.
However, this does not work. Does anyone know what's wrong with my syntax?
Welcome to WebmasterWorld!
Completely reverse the transform, not just the lines:
RewriteEngine On
RewriteRule ^/show_job.cgi/j/([0-9]+) /show_job.cgi?j=$1 [L]
#
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /show_job\.cgi\?j=([0-9]+)\ HTTP/
RewriteRule ^show_job\.cgi$ http://www.example.com/show_job.cgi/j/%1 [R=301,L]
Note that an external redirect [R] *must* not be used in the first rule. It will both expose your cgi call to visitor and search engines, and create an 'infinite loop' with the second rule.
Jim