Redirect users refered from a specific site
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, redirects, , , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :I have a portfolio website that I have created with wordpress theme X, that is featured on two websites that showcase examples made with theme X.
I am in the process of making a new portfolio website, based on my own wordpress theme, but I would like to keep the old website on a subdomain for the visitors that are refered from the showcase websites.
Is it possible to only redirect visitors that come from those specific sites to the subdomain (old.portfoliowebsite.com)?
Is there any way to do this (other than asking the showcase websites to change the link)?
One way that comes to my mind would involve using PHP:
$_SERVER['HTTP_REFERER']
You could check for the refering URL and implement a redirect accordingly:
if($_SERVER['HTTP_REFERER']=="http://www.example.com/")
my_redirection_fuction();
This is however a rather unreliable method since people can hide the refering url through browser privacy setting.
Comments
Post a Comment