MyBB Community Forums

Full Version: add custom link before every external url
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I want to add custom link like http://mysitename.com/link.php?

before every external url appearing in the forum.

It will then appear as
http://mysitename.com/link.php?http://externallink.com
http://community.mybb.com/thread-140521.html
have you tried earlier suggested plugin ? (I understand that you can easily modify php code)
Untested, but this should work:

Create a new MyCode. It doesn't matter what the title is. The regular expression should be this:

<a href="http([s]?)://(.*?)"

Then, change replacement to this:

<a href="http://www.mysitename.com/link.php?http$1://$2"

Create a second MyCode. Regular Expression:

<a href="http://www.mysitename.com/link.php?(.*?)"

Replacement:

<a href="http://www.mysitename.com/?$1"

And you're done.

Thanks to querschlaeger
well i got the solution as mentioned in this:
http://community.mybb.com/thread-81141.html

I am removing the rel="nofollow" and adding my custom domain name before http$1://$2

like this:
Replacement
<a href="http://mysitename.com/link.php?http$1://$2"

thank you Seabody....i am now doing the same as u said
I also needed this, with the help of you guys I have done this. Now can anybody tell me now

(Adding in OPs question)
how to redirect

"http://mysitename.com/link.php?http://externallink.com"


or

"http://mysitename.com/link?http://externallink.com"


to

"http://externallink.com"
??
If you using 1st method -tutorial
Just post http://externallink.com in your forum after just click on it and it redirects you to http://externallink.com
Thank u for your reply but it is not redirecting that way. It only shows

"http://mysitename.com/link.php?http://externallink.com"

In the address bar but not redirecting.

I dont have created any "link.php" file.
Do i need to create one?

And if yes what will be code in it?
1st of all which method you use tutorial or mycode

Ok you using mycode whats your forum url and plz provide test account
I am using mycode method
In that method you have make link.php file first
Pages: 1 2