0

I have web site in core php and I want to make my SEF URL. In my web site for transferring control from one page to other i have used something like

    header("Location: edit.php?id=12");

I read one article but couldn't get it how to implement it.

Link of article

So how i can make url to read like "mysite.com/usr/edit" I read lot on google i got the idea that i need to do something in .htaccess but i dont know what needs to do with url in php so i dont have to change major code in site.
Thanks in advance.

Satish
  • 1,012
  • 2
  • 15
  • 32
  • mod_rewrite. plenty of answers on this site about it. – Marc B Aug 06 '12 at 06:13
  • possible duplicate of [Mod_rewrite dynamic URLS](http://stackoverflow.com/questions/6236091/mod-rewrite-dynamic-urls) – Marc B Aug 06 '12 at 06:14
  • possible dupe in the essence of http://stackoverflow.com/questions/11022509/php-dynamic-db-page-rewrite-url – chris Aug 06 '12 at 06:17

1 Answers1

1

You can do it with the .htaccess code given below:

RewriteEngine On

DirectoryIndex index.php

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l


RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

after creating .htaccess file with above code. You will have all the stuff after the file name ex. "/usr/edit" in the GET parameter $GET['url']. After that you can do anything. Here is the working example of my MVC framework: https://bitbucket.org/ManthanB/my-framework/

You can contact me for further information.