View Full Version : Change Links Sitewide
GeForce
04-17-2004, 07:16 PM
Hello All!
I was just wondering is this is possible with any program. I currently have all my links as www.livescripts.co.uk/somedir/somepage.html and I want them all changed to www.livescripts.co.uk/go.asp?link=/somedir/somepage.html
Possible? Or not?
Thanks for any help!
Jonathan :cool:
oracleguy
04-17-2004, 07:20 PM
You could use regular expressions to go through and do what your wanting, assuming there is some consistancy in how the link paths are written.
GeForce
04-17-2004, 07:27 PM
Hi oracleguy!
The link paths are all written as www.livescripts.co.uk/whatever etc.
How would I use a regex to do this, I am not experienced with them.
Thanks!
CrzySdrs
04-18-2004, 01:01 AM
What languages do you know how to use? PHP or ASP would work. Depending on what server side language you are using I could write up a little bit that should be able to handle what you are doing. I would just need some more examples of links you want changed and what exactly you wanted them changed to, so I could encompass more or less all of the possiblities.
CrzySdrs
04-18-2004, 01:14 AM
Seeing as you are using ASP redirect page, I think this would work, you would just need to run everypage through a search and replace using regular expressions.
regex.pattern = "href=""http://www.livescripts.co.uk(.+?)"""
This pattern would catch all links in the page, and then you could use backreferences or submatches to get the value from the (.+?) and then replace with:
newlink = "href=""http://www.livescripts.co.uk/go.asp?link=" & match.submatches(0) & """"
depending on what you use to create the newlinks, you may have to change the code a bit.
If you want to just write an ASP or VBScript, the code should be about the same, you can check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriProperties.asp to find out more.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.