I’m trying to implement java like url pattern matching in php. Suppose i have a link which leads to a file called find.php (Example is shown below)
http://www.xyz.com/MyWebsite/TryToFind/find.php?search=abc+def
Then i want to expose the follwing link to the users, say,
http://www.xyz.com/Search?search=abc+def
then i want to match this(2nd url pattern) url to the one i have provided above(1st url pattern) using a controller. This is because i want to hide the exact uri pattern to the user and also the hide the extension which i have used.
Please Help Me Guys…
Regards,
Abilash
If you are using apache (which I assume you are as you have tagged
.htaccess) as your http server then you can use Apache’s Mod_Rewrite Module. It usually ships with most installations of Apache these days and anyways you can install one yourself if it is not present.Mod_Rewrite will enable you to achieve what you desire, In fact it is designed for that purpose only. While php frameworks like CodeIgniter provide some programming support for Mod_Rewrite, working directly with
.htaccessusing the Regex will render you with more power and flexibility.A full explaination is difficult here. But this was the tutorial I found handy when learning the same.