1

自从最后几个小时以来,我一直在努力让它工作,但没有运气......如果有任何帮助真的会很棒。

   Options +FollowSymLinks
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} ^example\.com$ [NC] 
   RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
   RewriteRule ^(.+)/$ /$1 [R=301,L]
   RewriteRule ^profile/(.*)$ details.php?profile=$1 [L,NC,QSA] 
   RewriteRule ^industry/(.*)$ category.php?industry=$1 [L,NC,QSA] 
   RewriteRule ^page/(.+)$ index.php?page=$1 [L,NC,QSA]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d 
   RewriteRule . /index.php [R=301,L]

很复杂吗?但实际上并不容易,但是当我尝试在上述规则集中添加一个规则时,它不起作用。

实际网址 -http://www.examples.com/req-info.php?tag=denis-reach-home&about=denis-reach&info=home

到网址 - http://www.examples.com/tag/denis-reach-home/denis-reach/home

我尝试了各种各样的东西,但没有运气.. 例如 -

RewriteRule ^tag/([^/]*)/([^/]*)$ /req-info.php?tag=$1&about=$2info=$3 [L]

任何专家都可以分享一些技巧。

先感谢您。

4

1 回答 1

1

你很亲密。在您的 .htaccess 中有此代码:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com$ [NC] 
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteRule ^(.+)/$ /$1 [R=301,L]
RewriteRule ^profile/(.*)$ details.php?profile=$1 [L,NC,QSA] 
RewriteRule ^industry/(.*)$ category.php?industry=$1 [L,NC,QSA] 
RewriteRule ^page/(.+)$ index.php?page=$1 [L,NC,QSA]

# your new rule
RewriteRule ^tag/([^/]+)/([^/]+)/([^/]+)/?$ req-info.php?tag=$1&about=$2info=$3 [L,QSA,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [R=301,L]
于 2012-11-25T04:02:00.460 回答