Add / remove a port number to/from a URL with REGEX in PHP

Posted by SuperDuck on Stack Overflow See other posts from Stack Overflow or by SuperDuck
Published on 2010-04-06T01:38:04Z Indexed on 2010/04/06 1:43 UTC
Read the original article Hit count: 406

Filed under:
|
|
|

Hello guys,

I've searched but was unable to find an existing regex function. Has anybody done this before?

I wish to add a port number, or remove a potantially existing one from a url in php. To use in some functions which translate a given url to the secure one, unsecure one, etc.

Now I need a second SSL secured site on the server so I need to dynamically add a port number while converting http to https, and remove any port number while converting from https to http.

Thanks, Duck

© Stack Overflow or respective owner

Related posts about php

Related posts about regex