你能告诉我重定向到那里的htaccess代码吗?urls:
-
https://www.example.com/forum/news/state-news/archive到https://www.example.com/forum/news/state-news?archive=yes
-
https://www.example.com/forum/news/state-news/city-news/archive到https://www.example.com/forum/news/state-news/city-news?archive=yes
-
https://www.example.com/forum/news/state-news/city-news/area-news/archive到https://www.example.com/forum/news/state-news/city-news/area-news/?archive=yes
我尝试过的htaccess文件是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(core/libraries/|includes|core/includes|core/vb|core/vb5|core/admincp|core/modcp) index.php?routestring=relay/404 [END]
RewriteRule ^css.php$ core/css.php [NC,L]
RewriteRule ^install/ core/install/ [NC,L]
RewriteCond %{REQUEST_URI} !.(gif|jpg|jpeg|png|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
</IfModule>
按照以下方式创建htaccess规则文件。我特别介绍了您在问题中显示的3个URL。请确保使用这些规则,并确保在测试URL之前清除浏览器缓存。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(core/libraries/|includes|core/includes|core/vb|core/vb5|core/admincp|core/modcp) index.php?routestring=relay/404 [END]
RewriteRule ^css.php$ core/css.php [NC,L]
####I have commented below rule that doesn't make sense, since NO right part in it only condition is mentioned.
####RewriteRule ^install/core/install/ [NC,L]
###New rules added by me to handle 3 different URLs shown by OP in question.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(forum/news/state-news(?:(?:/city-news(?:area-news))))/(archive)/?$ $1?$2=yes [NC,QSA,L]
RewriteCond %{REQUEST_URI} !.(gif|jpg|jpeg|png|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php?routestring=$1 [L,QSA]
</IfModule>