我正在我的网站上构建Pebble Watchface配置页面,从Cloud Pebble为该页面自动生成的URL以%3F结尾:
http://andr01dm.com/pebble/faciem/config.html?return_to=https%3A//cloudpebble.net/ide/emulator/config%3F但此URL在我的网站上导致501方法未实现错误。我发现,如果我手动从查询字符串中删除%3F,它会按预期工作。
我在考虑使用htaccess规则将URL更改为如下所示:
http://andr01dm.com/pebble/faciem/config.html?return_to=cloud我已经写了一个规则,它在网站工具中工作,我正在测试它( http://htaccess.madewithlove.be/ ),但它在我的网站上不起作用。你能看看我的尺子,让我知道它看起来是否正确吗?
RewriteCond %{QUERY_STRING} ^return_to=https://cloudpebble\.net/ide/emulator/config\?$
RewriteRule config.html config.html?return_to=cloud [R=301,L]我的网站运行的是阿帕奇和ModX革命CMS。谢谢。
编辑:这是我的网站的完整.htaccess (去掉评论)
AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^andr01dm\.com [NC]
RewriteRule (.*) http://^andr01dm.com/$1 [R=301,NE,L]
RewriteCond %{QUERY_STRING} ^return_to=https://cloudpebble\.net/ide/emulator/config\?$
RewriteRule config.html config.html?return_to=cloud [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]发布于 2017-02-26 18:09:13
这个方法对我很有效:
# === remove extra question mark ===
RewriteCond %{QUERY_STRING} ^(.*)%3F$ [NC]
RewriteRule .* %{REQUEST_URI}?%1 [R,L]https://stackoverflow.com/questions/31081155
复制相似问题