I have two pages:
categories.php
in categories.php page I fetch all categories.
news.php
in news page I fetch news by id.
I have used mod_rewrite for categories:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-/]+)$ categories.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+)/$ categories.php?url=$1
site/categori1 ----> this rule works for categorie page
Is it posible open mod_rewrite two different page?(categories.php and news.php)
RewriteRule ^([a-zA-Z0-9-/]+)$ news.php?url=$2
RewriteRule ^([a-zA-Z0-9-/]+)/$ new.php?url=$2
site/news-title1 above rule not working for news.php page.
How can I use mod_rewrite for two different pages?
Thanks in advance
You have to be more specific with what your regular expression is matching:
‘^([a-zA-Z0-9-/]+)$’ will match almost everything.
You need to decide what differentiates a category page from a news page and match on that, eg:
You can differentiate the rules in some other way, but you do have to do it.
You could, for instance, rearrange the rules in my suggestion above to make the category rule catch everything which isn’t prefixed with news: