Friday, March 11, 2016

301 redirects in Apache that preserve the referrer



Our web developers are using JavaScript redirects - first of all this does not work well for SEO and secondly, it does not preserve the http_referrer (therefore it does not show up in our web stats). So I'd like to get a 301 redirect in Apache, but I want to ensure the referrer will be passed along.



Does anyone know how to preserve the referrer with 301 redirects in Apache?



Will a 301 redirect with mod_rewrite preserve the referrer by default? Or do I need to use some custom code with mod_rewrite?


Answer




You can do 2 things in your apache VirtualHost config:





But i think when you have to many rewrites you should write the rewrites to a .htaccess file.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...