phpwindows.htaccessurl-rewriting

php file renaming virtually wamp environment htaccess


Does PHP supports htaccess URL rewriting in Windows - WAMP Environment?

How can I use it?

Below is one example:

My existing file name and URL is like below:

http://localhost/um/api_user_registration.php?FIRSTNAME=first_name&LASTNAME=last_name&USERNAME=user_name&EMAIL=abc@abc.com

Can I use it like below:

http://localhost/um/UserRegistration.mac?FIRSTNAME=first_name&LASTNAME=last_name&USERNAME=user_name&EMAIL=abc@abc.com

In short, I want to access file as UserRegistration.mac instead of api_user_registration.php

Please suggest a way of doing.


Solution

  • URL rewriting is done using mod_rewrite, an apache module. Make sure that it's loaded (probably in httpd.conf) and then add this to the htaccess file in your /um/ folder:

    RewriteEngine On
    RewriteBase /um/
    RewriteRule ^UserRegistration\.mac$ api_user_registration.php [L]