【发布时间】:2014-06-25 09:43:50
【问题描述】:
通过使用以下 .htaccess
RewriteEngine On
RewriteRule ^([0-9]+)/([0-9]+)$ /api/web/index.html#$1/$2 [R=301,NC,L]
当用户在浏览器中键入以下 URL 时。
http://localhost:8080/1/2
我期待,Apache 将执行内部重定向,并在浏览器上更改显示的 URL(通过 R=301)。
http://localhost:8080/api/web/index.html#1/2
在浏览器中更改显示的 URL 很重要。这是为了保证index.html的JavaScript能够正确解析url。
然而,我真正得到的是
http://localhost:8082/api/web/index.html%231/2
我会得到 Apache 错误。
Apache 错误地认为,我希望获取位于目录 api/web/index.html%231/ 中的名为 2 的文件
有什么我可以通过修改.htaccess来解决这个问题的吗?
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect