Forum Moderators: phranque
redirect 301 /abc/?Korea_Facts h##p://www.abc.com/korea_facts.php
... but when I upload it to my htaccess file, nothing happens, it simply does not work and the page goes straight to the /index.php. I just can't figure out why. Can anyone see any problems that a web learner like me would miss?
Note, the ##'s were deliberate so a hyperlink doesn't appear..... and I am not the owner of abc.com ;)
Welcome to WebmasterWorld!
If you are trying to redirect a URL with an appended query string, and based on that query string's value, then you'll probably need to use mod_rewrite. In Web-root directory .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^Korea_Facts
RewriteRule ^abc/?$ http://www.example.com/ [R=301,L]
Note here that the question mark in the RewriteRule pattern is not a literal. It is a regex token that makes the trailing slash on the URL optional.
Depending on your server configuration, you may not need the Options directive. In fact, it may cause problems if it is present but not needed, as well as if it is needed but not present. And if you already have other working rules, then you won't need the RewriteEngine directive, either.
For use in httpd.conf, add a leading slash to the RewriteRule pattern.
Jim