views:

57

answers:

1

Hi I am creating a site with some vanity url's i.e.

http://www.domain.com/Email

What I'd like to do is use htaccess to redirect any subdomain i.e. the /Email to the main domain.com where an index.php will record what the subdomain is.

Is this possible or am I making this up?

A: 

I don't think you mean "subdomain", but I think you might do what you want by putting something like this in your .htaccess file:

RewriteEngine On
RewriteRule ^([-_A-Za-z0-9]+)$ /index.php?id=$1 [L]

Then, in your index.php file, you should be able to use $_GET['id'] to determine what you refer to as the "subdomain" in your example. To test this, put <?php var_dump($_GET); ?> in your index.php file.

Tomba