I am writing a small script in which it redirects to country specific landing pages(example: if you come from Germany you will be re-directed to xyz.com/de/
) this redirection happens using index.php which connects to web service returns the country the user is accessing the website from then I redirect the user using 301 to a the new page xyz.com/de/
I have two questions
1- Can the same functionality integrated with mod_rewrite
, if so what is the advantage in terms of performance and SEO quality?
2- Can the mod_rewrite save the query string including GCLID
on the redirects (as I am concatenating the $_SERVER
to php redirection
You can install mod_geoip on your server, which enables database-based geolocation lookup directly inside Apache. Look at the examples for exactly the scenario you talk about.
The advantage would be much better performance, since the lookup will be done locally using a database, instead of needing to call an external web service. It also requires virtually no code once this is set up, easing maintenance. You will only have to make sure your local copy of the lookup database is regularly updated, typically with a weekly/daily cron job.
You can rewrite the URL in any way you want appending any parameters you want.
SEO-wise it should have no effect at all compared to PHP based redirects, since to the client the behaviour appears exactly the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With