htaccess解码url有三个值



下午好,

我正在尝试编辑我的.htaccess,以便用3个值解码url。

url的一个例子是:example.com/VALUEa/article VALUEb&VALUEc

我尝试过的代码如下,但它不起作用。

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^([^/]+)/article-([^/]+)&([^/]+) request.php?VALUEa=$1&VALUEb=$2&VALUEc=$3 [L]

你有什么建议可以纠正吗?

#编辑1和2

我试图按照建议编辑代码,但仍然不起作用。我插入的新的完整代码如下:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^  https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]
RewriteRule ^sitemap.xml sitemap.php [NC,L]
RewriteRule ^/?$ index.php [NC,L]
RewriteRule ^images/favicons/([^/]+)/?$ images/favicons/$1 [NC,L]
RewriteRule ^images/([^/]+)/?$ images/$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/article-([^/]+)&([^/]+)/?$ request.php?VALUEa=$1&VALUEb=$2&VALUEc=$3 [NC,L]

感谢

对于您显示的示例,您可以尝试以下规则吗。请在测试URL之前清除浏览器缓存。

RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^  https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]
RewriteRule ^sitemap.xml sitemap.php [NC,L]
RewriteRule ^images/favicons/([^/]+)/?$ images/favicons/$1 [NC,L]
RewriteRule ^images/([^/]+)/?$ images/$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/article-([^/]+)&([^/]+)/?$ request.php?VALUEa=$1&VALUEb=$2&VALUEc=$3 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,NC,L]

最新更新