In my website I have a form from which the users can choose to search for specific title in news database.
They can choose main rubric (for example Businnes) and subrubric (for example Local)and after that to enter some string to search.
After they submit the form the webpage returns the requested infromation and the url looks like this.
foo.bar/1001/234/
where 1001 is id of Businnes and 234 is id of Local
How to do so id`s to be replaced by relevant names ?
foo.bar/Businnes/Local/
This can be done using apache/htaccess/mod_rewrite, then handled by PHP
From there you need to use
$_SERVER['REQUEST_URI']and parse out the data you need.The first line turns on the rewrite engine.
The second 3 lines says,
if the requested file or directory does not exist, send the request to index.phpYou can just explode the
$_SERVER['REQUEST_URI']to get the parts of the data you need, no regex required.