Reputation: 21
Please help me, I have two cases, I have a URL to redirect, for example
https://example.com/about-us and my rewrite rule is
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?pageName=$1 [QSA,L]
and it is working perfectly for all pages with query pageName.
I want to redirect a different query string to this same structure like I have URL like
https://example.com/index.php?filter=latest
and I want to redirect this to the same format like above for about us page e.g
https://example.com/latest
how it can be possible? please help me, thanks
Upvotes: 0
Views: 103
Reputation: 41219
You can't use same format or URI pattern for two rules , you can however change your second URL format to look something like https://example.com/second/latest
here second
can be any word you want add in the rule's pattern
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^second/([^/]+)/?$ index.php?filter=$1 [QSA,L]
Remember to put this rule at the top or before the existing one.
Upvotes: 2