How can I redirect a user to an external site while linking to an internal page ?
I have seen examples like:
- example.com/go/ksdjfksjdhfls
- example.com/?go=http://www.new-example.com
- … And many more…
How this is achieved in php ?
Does this have any pros/cons with regards to SEO ?
I don’t see any benefit in this approach, but there are a few ways to achieve it. To do it with the
GETquery, you would simply need the following code:HTML:
PHP:
With the above example, it will actually take the user to that location, not to:
To achieve the url being “local” while pulling up a remote site, you’d either have to:
So of the three server-side methods I can think up, one may or may not be possible, and is a pain. One will be crippled and put a heavy load on the server. The last is a known bad guy and is likely not to work for many cases.
So I’d just go with a redirect, and really, if you don’t need the address bar to show the local URL, then I’d just have a direct link.
All of the raises the question: What are you hoping to accomplish?