I'd like to ask how can I call the page www.domain.com/index.php?page=somepage and make the browser show the user in the URL bar the address www.domain.com/somepage/? How do I do that trick?
|
|
||||
|
|
you need the webserver module to do this. if you running Apache for example you can use mod_rewrite to acomplish this type of URLs. for the .htaccess file you need basic knowledge of regular expressions a good start: http://www.modrewrite.com/ |
|||
|
|
open up .htacess and put that code in there. read more here http://www.workingwith.me.uk/articles/scripting/mod_rewrite |
|||
|
|
As mentioned by Michele, you'll need Apache to do this with mod_rewrite. The above will send all page requests to index.php?page=[somepage], unless the file or directory exists (for things like images). But you may also want to something more specific so all requests don't get sent to index. You would do something like:
Although this can get messy if you have a lot of pages, so then you might want something like:
This will only send all the requests that match the regular expression |
|||
|
|