Remove Subdomain from url

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
greendezine
Forum Newbie
Posts: 1
Joined: Tue Aug 17, 2010 8:24 pm

Remove Subdomain from url

Post by greendezine »

Does anyone know how to first get the current URL (which always contains a subdomain) then remove the subdomain and print the result?

For Example, turn this:
<a href ="http://shop.mydomain.com/subdirectory">Link</a>

into this:
<a href ="http://mydomain.com/subdirectory">Link</a>
Post Reply