2013-08-09 3 views
0

Я Тринг retwite:RewriteRule и RewriteCond не работает

http://example.com/industry/fn/bpo-jobs 

в

http://example.com/industry.php?fn=bpoobs 

и точно так же:

http://example.com/industry/cat/obs 

в

http://example.com/industry.php?cat=obs 

Используя следующие правила:

<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> 

Но он не работает должным образом, я думаю, что это лечение

http://example.com/industry/fn/bpo-jobs 

в

http://example.com/industry.php 

Нужна помощь, чтобы решить ее.

Спасибо

ответ

0

Вам не нужно заявление RewriteCond.

Попробуйте это (без RewriteCond):

RewriteRule ^industry/fn/(\w+)$ industry.php?fn=$1 [L] 
RewriteRule ^industry/cat/(\w+)$ industry.php?cat=$1 [L] 

Или, проще говоря, это:

RewriteRule ^industry/(cat|fn)/(\w+)$ industry.php?$1=$2 [L] 
Смежные вопросы