views:

59

answers:

3

I have a file with .php extention www.example.com/thefile.php?name=123 that I want to direct the user to if the user visits any of the following aliases:

www.example.com/alias?name=123
www.example.com/unreal?name=123
www.example.com/fake?name=123

Is there a way I can get this done without using a framework that already uses this structure? I'm using pure php.

+1  A: 

You will have to use mod_rewrite and .htaccess files to achieve this (if you are running Apache that is).

Sbm007
+1  A: 

If you are using Apache, you can use mod_rewrite to do this.

A nice article about it: Using htaccess Files for Pretty URLS

Keiji
+5  A: 

Yes you can, if you have mod_rewrite activated on your Apache Server, you can add a .htaccess file at the root of your website and have something like this into it (not 100% sure since I don't have Apache here at home) :

RewriteRule ^(alias|unreal|fake)$ thefile.php [QSA]

You can consult Apache mod_rewrite doc here

MaxiWheat