View Full Version : htaccess url rewrite

04-08-2007, 11:01 AM

I am trying to create good looking urls for my website. But after reading several tutorials it still does not work the way I do it.

I'd like to change www.mywebsite.com/?p=home
to be seen by surfers as www.mywebsite.com/home
but still it needs to be rewritten to the first, in order to make the site work off course.

I also tried with reg.ex. but this makes the site not show the css since this is rewritten as well....

There are only little few pages where I'd like to do this. So I guess using a reg.ex. is required. I can just set them manually by hand.

Could anyone please give me some feedback or tips on this subject?


Bill Posters
04-08-2007, 12:41 PM

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^[-_a-zA-Z0-9]/?$ index.php?p=$1

Alternatively, if you have a set number of options, you can be more explicit, if you want...

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([home|about|section3|section4])/?$ index.php?p=$1