Change url in PHP

I have Url as:

localhost/ab/directory.php?id=200 

id = 200 - member jenny id

how to change it to

 localhost/ab/jenny 

perhaps?

thanks

+5
source share
4 answers

You will want to use mod_rewrite, a module available in apache. This will be controlled by the .htaccess file in your web directory. AddedBytes has a good beginner rewrite tutorial.

See: http://www.addedbytes.com/for-beginners/url-rewriting-for-beginners/

+11
source

You can do this in at least two different ways:

  • Use mod_rewrite for Apache to map the SEO URL to your request-specific URL.
  • Make a /ab PHP script that checks PATH_INFO to extract /jenny . You will have to configure Apache to handle scripts without extension as php scripts for this.
+1
source
0
source

All Articles