Forum Moderators: phranque
I need to redirect a cgi url to a static page.
For example /dummy.cgi?ID=123 it should redirect to
/dummy/d123.html
I have tried using this rule but it fails.
RewriteEngine on
Options +FollowSymlinks
RewriteBase /cgi-bin/
RewriteRule ^"\(dummy.cgi?ID=\)"(.*) /dummy/d$2.html [R=301,L]
What I am I doing wrong.
Thanks.
Welcome to WebmasterWorld [webmasterworld.com]!
> For example /dummy.cgi?ID=123 should redirect to /dummy/d123.html
Options +FollowSymlinks
RewriteEngine on
RewriteBase /cgi-bin/
RewriteCond %{QUERY_STRING} ^ID=(.*)$
RewriteRule ^dummy\.cgi$ /dummy/d%1.html [L]
I should point out here that it is far more usual to rewrite static URLs to dynamic ones in order to call scripts. The scripts then output static URLs for visitors and search engine spiders. However, the code modification above should get you closer to what is needed to do what you asked for.
Introduction to mod_rewrite [webmasterworld.com]
Jim
RewriteRule ^dummy\.cgi$ [b]http:[i][/i]//www.example.com[/b]/dummy/d%1.html? [[b]R=301,[/b]L]
RewriteRule ^[b]/[/b]dummy\.cgi$ http:[i][/i]//www.example.com/dummy/d%1.html? [R=301,L]