Writing .htaccess Rewrite rules with similar strings

Viewed 34

I am writing rules in my .htaccess file to configure the URL shown.

In my site I have two pages. Eg. page.php and page_edit.php.

I my .htaccess file I am making the following rules:

RewriteRule ^page page.php [NC,L]
RewriteRule ^page/create page_edit.php?editID=1 [NC,L]

However, the 2nd rule never gets caught and the page is always directed to page.php (the first rule). I guess this is becuase it is has the string for the first rule ('page') as a substring.

How can I get round this?

1 Answers

you can change Rule order, the more specific in top

RewriteRule ^page/create page_edit.php?editID=1 [NC,L]
RewriteRule ^page page.php [NC,L]
Related