【发布时间】:2012-02-24 12:27:14
【问题描述】:
我在位于名为clips/ 的目录中的 .htaccess 文件中有此规则:
RewriteRule ^mlk/?$ segment/index.php?clip=1 [R=301,QSA,L]
我的意图是当有人访问http://example.local/clips/mlk 时,他们会被重定向到http://example.local/clips/segment/index.php?clip=1
实际上发生的是,当有人访问example.local/clips/mlk时,他们会被重定向到example.local/var/www/example/clips/segment/index.php?clip=1
我不确定它为什么这样做。如果我将重写规则更改为:
RewriteRule ^mlk/?$ /segment/index.php?clip=1 [R=301,QSA,L]
用户被重定向到example.local/segment/index.php?clip=1,仍然不正确。如果这些文件在网站的目录树中移动,我不想指定绝对路径。我怎样才能让它相对而不是绝对地工作?
【问题讨论】:
标签: linux mod-rewrite redirect ubuntu apache2