I am tring to retwite:
http://example.com/industry/fn/bpo-jobs
to
http://example.com/industry.php?fn=bpoobs
and similarly:
http://example.com/industry/cat/obs
to
http://example.com/industry.php?cat=obs
Using following rules:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteCond %{QUERY_STRING} (^|&)fn=(.*)(&|$)
RewriteRule ^industry/fn/(\w+)$ industry.php?fn=$1 [L]
RewriteCond %{QUERY_STRING} (^|&)cat=(.*)(&|$)
RewriteRule ^industry/cat/(\w+)$ industry.php?cat=$1 [L]
</IfModule>
But it is not working properly, I think it is treating
http://example.com/industry/fn/bpo-jobs
as
http://example.com/industry.php
Need help to resolve it.
Thank you
You don't need the RewriteCond statements.
Try this (without the RewriteCond):
RewriteRule ^industry/fn/(\w+)$ industry.php?fn=$1 [L]
RewriteRule ^industry/cat/(\w+)$ industry.php?cat=$1 [L]
Or, more simply, this:
RewriteRule ^industry/(cat|fn)/(\w+)$ industry.php?$1=$2 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.