By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,079 Members | 926 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,079 IT Pros & Developers. It's quick & easy.

mod_rewrite - Help, I'm a newbie...

P: 13
I've got URLs that look like:
Expand|Select|Wrap|Line Numbers

I want the URLs to look like:
Expand|Select|Wrap|Line Numbers

How do I write this RewriteRule into my .htaccess file? Or, is there a better way.

I originally wrote a separate rule for every single URL, but, as you could imagine, the performance of the site took a huge hit. (see example below).

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine On
  2. RewriteRule ^$
  3. RewriteRule ^(about/history/|about/history)$ template.php?id=about/history
  4. RewriteRule ^(services/|services)$ template.php?id=services
  5. RewriteRule ^(contact/|contact)$ template.php?p=contact
  7. etc., etc., etc.
And I thought, "There must be a way to write one or two rules that would cover all these URLs." Any help would be great.

Also, I'm a newbie to code -- design's my gig -- so directing me to the Apache docs will not help me much, unfortunately (as it's Greek to me).

Perhaps an example, or citing an article with examples would help me.

Thank you very much.
Nov 18 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.