【发布时间】:2018-02-07 11:27:19
【问题描述】:
我需要一些关于正确 RewriteRule 的帮助。
需要以 JSON 字符串结尾的 URL:
http://hns/log/r/%7B"start":%5B55.70980850022872,37.505353142456336%5D,"end":%5B55.70980850022872,37.77039830847196%5D,"points":%5B%5B55.67529029803404,37.62070958776883%5D%5D,"method":"1","optimization":"1","center":%5B55.731512133266634,37.71615331335479%5D,"zoom":10%7D
重定向到
http://hns/log/r/index.html
无需更改浏览器中的 URL。
.htaccess 是:
RewriteEngine on
RewriteBase /log/r/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([^/]+)$ ./index.html?catalog=$1[L]
RewriteRule ^([A-Za-z0-9?;:,{}\"]+)$ ./index.html [L]
它适用于以下 URL:http://hns/log/r/,132a。
但不适用于以下 URL:http://hns/log/r/,132a: 或引号 (") 或 JSON 字符串。
如何正确重定向此类 URL?
【问题讨论】:
-
这个
.htaccess文件在哪里?我认为它必须在/logist/route/.htaccess?/log/r/是/logist/route/的简写吗?还是完全不同的 URL 路径? -
抱歉,重定向应该是
http://hns/log/r/index.html。 .htaccess 文件位于http://hns/log/r
标签: .htaccess mod-rewrite