views:

38

answers:

2

Hi everyone.

I've got a small CMS system written in PHP and running on Apache. The format of the URLs this CMS system uses/generates is:

/display.php?PageID=xxx where xxx is just some integer number. As you can see, those URLs are not very friendly, neither for users nor search engines.

I believe that using mod_rewrite (or something like that) and .htaccess files I should be able to configure Apache for URL-rewriting. I have searched for information about this before but I did not find any easy method to do this, it always involved messing with regular expressions, which I'm not very familiar with.

Since the website in question is really simple and small, just 5-10 different pages, I would really like to be able to just hard-code the configuration, without any special rules or regexps.

I'd just like to map a friendly URL to an actual URL, perhaps like this:

/about = /display.php?PageID=44
/products = /display.php?PageID=34

etc.

Is it possible to configure the mod_rewrite plugin in a basic way like this?

Could someone explain the easiest method to do this? Explain it to me as if I was a child :-)

Thanks in advance!

A: 

URL Rewriting for Beginners is my favorite intro article to this, it should cover what you're looking for. In fact, the first actual example where you write a .htaccess file is almost identical to what you want.

Chad Birch
Thanks, I will check out that article!
HaukurHaf
A: 

well putting something like

RewriteEngine on

RewriteRule ^about$  ./display.php?PageID=44
RewriteRule ^products$ ./display.php?PageID=34

in your .htaccess-file shouldn't be the big deal I think...

lazerscience
I see, this looks simple enough. Will give it a go. Thanks :-)
HaukurHaf