How do i change the url http://localhost/Test/www/#/home/login.php?name=abc
to
http://localhost/Test/www/#/home/login/abc
I need to access the name variable from url
I have tried to modify .htaccess but i am getting. Please some help me out.
How do i change the url http://localhost/Test/www/#/home/login.php?name=abc
to
http://localhost/Test/www/#/home/login/abc
I need to access the name variable from url
I have tried to modify .htaccess but i am getting. Please some help me out.
For you to achieve that, you can do a mod_rewrite (placed in an .htaccess
file) rule that looks something like this:
RewriteEngine on
RewriteRule ^/login/([0-9]+)\.html /login.php?name=abc
And this maps requests from
/login.php?name=abc
to
/login/abc.html
Another possibility is doing it with forcetype
, which forces anything down a particular path to use php to eval the content. So, in your .htaccess file, put the following:
<Files login>
ForceType application/x-httpd-php
</Files>
And then the index.php
can take action based on the $_SERVER['PATH_INFO']
variable:
<?php
echo $_SERVER['PATH_INFO'];
// outputs '/abc.html'
?>