我在最近几个小时内努力工作但没有运气......如果有任何帮助真的很棒。
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]
任何专家都可以分享一些提示。
提前谢谢。
答案 0 :(得分: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]