I've got URLs that look like:
- www.mysite.com/template.php?id=pagetitle
-
www.mysite.com/template.php?id=folder/pagetitle
I want the URLs to look like:
- www.mysite.com/pagetitle
-
www.mysite.com/folder/pagetitle
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).
-
RewriteEngine On
-
RewriteRule ^$ http://www.mysite.com/template.php?id=home
-
RewriteRule ^(about/history/|about/history)$ template.php?id=about/history
-
RewriteRule ^(services/|services)$ template.php?id=services
-
RewriteRule ^(contact/|contact)$ template.php?p=contact
-
-
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.
Brad