Forum Moderators: phranque
I'm trying to redirect someone to an external domain if a script is being called on my server with a specific name/value pair.
For example, if cmd=test is anywhere in a query string for script.cgi (www.website.com/script.cgi?cmd=test), I want to send the person to www.siteb.com.
Thanks!
Welcome to WebmasterWorld [webmasterworld.com]!
Please post your code, and we'll try to help, but in accordance with our charter [webmasterworld.com], we can't write it for you.
You can also try this search [google.com] for some ideas.
Jim
I tried that search but still couldn't find anything :(
Here are a couple different things I tried but to no avail:
RewriteCond %{QUERY_STRING} ^cmd=test$
RewriteRule ^script\.cgi$ [siteb.com...] [R,L]
RewriteCond %{QUERY_STRING} script\.cgi\?(.*)?cmd=test
RewriteRule .* [siteb.com...] [R,L]
Thanks
rewriteCond %{query_string} cmd=test
rewriterule ^script.cgi$ [siteb.com...] [R,L]
This code should work if placed in the .htaccess file in your web root directory:
RewriteCond %{QUERY_STRING} cmd=test
RewriteRule ^script\.cgi$ http://www.siteb.com [R=301,L]
Options +FollowSymLinks
RewriteEngine on
For use in httpd.conf, change the rule to read:
RewriteRule [b]^/s[/b]cript\.cgi$ http://www.siteb.com [R=301,L]
Jim