-1

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.

  • Look at these ans; http://stackoverflow.com/questions/812571/how-to-create-friendly-url-in-php http://code.tutsplus.com/tutorials/using-htaccess-files-for-pretty-urls--net-6049 http://www.9lessons.info/2011/04/seo-friendly-urls-with-php.html – Sanoj Sharma Mar 08 '16 at 06:59
  • what `#` for ? mosty rewriting do with .htaccess – Shayan Mar 08 '16 at 06:59

1 Answers1

0

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'
?>
Newton Sheesha
  • 1,245
  • 1
  • 8
  • 13