Forum Moderators: phranque

Message Too Old, No Replies

Can mod rewrite be used as a Url Pattern matching mechanism?

         

boumbo

8:49 pm on Jan 28, 2007 (gmt 0)

10+ Year Member



Hi everyone,

I would like to add a new functionality to a website to make URLs in the browser window more readable for users. Some sort of Url Pattern matching mechanism that would Hide the real URL on the browser window and instead show a simpler URL.

My website is running PHP Version 5.1.1-gentoo, Apache 2.0, and MySQL 4.1.14. Im using an OpenSource CMS called Xoops (xoops.org) which makes the website much more dynamic.

Every URL is dynamically generated by php commands with the help of the CMS, Xoops.

I.e.
Instead of having to type the following URL:
1) http://www.example.com/modules/minaweb/i...t egory&id=28

You could type the following and it would still lead to the above url but would only show the url below in the browser window:
2)
http://www.example.com/page/28/comment

URL 2) would not change even if URL 1) would eventually change.

I found this rewrite rule on the apache url rewrite guide ( [httpd.apache.org...] ):
Content handling - Rewrite from Old to New (intern)

Is this a suitable solution?
It looks to me like this is not what I am looking for, as this only allows a site to be redirected without the user knowing of the change. But the idea of showing a simpler URL to the user while hiding the real one is what I am looking for, and also the fact I'm using a CMS that generates Url dynamically with the help of a database has to be taken in consideration.

If anyone knows of an efficient rule using mod_rewrite or any other module please let me know.

Thanks.

[edited by: jdMorgan at 9:50 pm (utc) on Jan. 28, 2007]
[edit reason] Example.com -- Please see Terms of Service. [/edit]

jdMorgan

9:54 pm on Jan 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will need to modify your CMS to output these shorter, friendlier URLs on your pages.

Then mod_rewrite can be used to rewrite those friendly URLs back to the long form needed by your CMS to produce the proper page when the friendly URL is requested by the client.

To get started, see this thread [webmasterworld.com] from the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

boumbo

10:48 pm on Jan 28, 2007 (gmt 0)

10+ Year Member



Right on target.

Thanks for the link.