How to make nginx virtual directories accessible in php?

Viewed 1862

Let's say I have a web server (nginx) server.com where I have only one php file index.php (there is no directory structure). I want to be able to access anything after server.com. It will be an url structure. For example server.com/google.com, server.com/yahoo.com.au etc...

An example would be http://whois.domaintools.com/google.com (They don't have a directory that's called /google.com, right?)

Q1: How can I access whatever is after 'server.com' from index.php

Q2: Can I get the protocol from such URL? For example server.com/http://www.google.com or server.com/https://www.google.com

PS I'm not certain if the term virtual directory is used here correctly. I just want to do what I saw somewhere else.

5 Answers
Related