PHP: Parsing Search Engine Friendly URL

A typical URL looks like this: some_domain/index.php?section=about&content=me A search engine friendly URL looks like this: some_domain/index.php/about/me To get the ‘/about/me’ part of the URL, it’s returned by standard php variable $_SERVER[’PATH_INFO’]. To parse it into parts: explode splits the string into array delimited by “/”. Because the string starts with “/”, the first array element will not…

Continue Reading »

PHP: Current URL

$_SERVER[’HTTPS’] will be non-empty value if it’s running over SSL or using HTTPS protocol. $_SERVER[’SERVER_PORT’] 80 is standard port and 443 is standard ssl port. The port number will be appended to the URL if not using these 2 standard ports.