I have two links (www.link1.com) and (www.link2.com), i want whenever a user clicks on link1, he'll be redirected to link2. This is easy to do, but what if I don't want full link2 url written anywhere in link1 source code. How would i achieve that?
Possible solutions i'm thinking
Maybe link2 would be located in a database and upon clicking link1, it will go to the database and click on link2.
Maybe link2 would be located in another website and with help of javascript small reference of link2 in link1 it will locate link2 in the website and click it.
Maybe a webapage2 will contain list of links (link1,link2,link3,link4), then if a user clicks link1 in webpage1, then link1 would be clicked, if the user clicks link2 in webpage1 then link2 in webpage two would be clicked.
The essence is to not load webpage2 but be able to click the link in webpage2.
CodePudding user response:
use PHP it don't show the redirect code in source code
CodePudding user response:
Like you said, you could probably store it in a database. Since, generally, a DB requires a backend, you could also send the website to the frontend from the backend for interpolation (I use Django, so probably sending via context would work). Using backend, you could also just redirect (Django - django.shortcuts.redirect()
). You could also store an encrypted string and write a function to decrypt it and then redirect to the value which the decrypt function returns. You mentioned you don't want it to be seen in the source code of the website, so probably sending the name of the website to be redirected to as a GET or a POST parameter. You could also set a domain name in DNS and the IP address as that of another domain.