Forum Moderators: phranque
Here is my .htaccess file
RewriteEngine on
RewriteRule ^category(.*).html$ index.php?page=category&category_id=$1 [L]
RewriteRule ^article(.*).html$ index.php?page=article&article_id=$1 [L]
RewriteRule ^page_(.*).html$ index.php?pagedb=$1 [L]
RewriteRule ^categories.html$ index.php?page=allcategory
RewriteRule ^index.html$ index.php
Also I need to rewrite the following line
[mysite.com...]
to look like
[mysite.com...]
Please help
Thanks
I
The other problem it looks like you are going to run into is: the first rule will match the pattern you have specified in the rule you would like to add.
Without more information about why your rules are written the way they are, there is not much information we can give you. You might want to have a look in the Apache Library (link at the top left of the pages) to get a working knowledge of mod_rewrite and regular expressions...
Justin
Personally, I don't think it's a good idea to use something we don't understand well and/or we can't maintain by ourselves.
Too many people are using "Short URL" type of things without really knowing what to do
and ask these questions expecting someone to write the code for them (and for free...).
Unfortuantely, RewriteRules are not very easy, and influenced by many factors.
Most of the time, it would be easier to parse and treat URL in the script, like Drupal and some other CMSs do.
Also, by using prefix (or other methods), the use of !-f and !-d can be avoided to reduce the processing cost.
Example:
RewriteRule ^prefix(.*)$ index.cgi [L]