【发布时间】:2012-05-26 10:32:17
【问题描述】:
我想设置一个重写规则
RewriteRule /test /my/long/path/index.html
但是我的 index.html 通过 ajax 获取其他文件,所以它不像这样简单。我需要为目录的所有子文件制定规则
我试过了:
RewriteRule /test /my/long/path/
RewriteRule /test/* /my/long/path/*
对不起,我对 Apache 的无知,谢谢
【问题讨论】:
-
我认为你需要在 /test 之后有一个
/。否则,对于<img src="plaatje.jpg" />之类的引用,浏览器会在根 (/) 中查找 plaatje.jpg,而不是在 /test 文件夹中。 -
RewriteRule /test/ /my/long/path/index.html,同样的,页面无法完全加载,因为 /my/long/path/index.html 获取一些文件,如 /my/ long/path/file.json,在/test/file.json中找不到它们
标签: apache mod-rewrite