mod_rewrite 是否自动设置“Alias”,还是应该在执行“RewriteBase”时显式指定?
# /abc/def/.htaccess -- per-dir config file for directory /abc/def
# Remember: /abc/def is the physical path of /xyz, i.e., the server
# has a 'Alias /xyz /abc/def' directive e.g. #
RewriteEngine On
# let the server know that we were reached via /xyz and not
# via the physical path prefix /abc/def
RewriteBase /xyz
# now the rewriting rules
RewriteRule ^oldstuff\.html$ newstuff.html
这些行:
# Remember: /abc/def is the physical path of /xyz, i.e., the server
# has a 'Alias /xyz /abc/def' directive e.g. #
意味着
mod_rewrite 根据 .htaccess 文件自动设置 Alias /xyz /abc/def'
或显示在conf中明确指定文件?
From: RewriteBase Apache Docs
# /abc/def/.htaccess -- per-dir config file for directory /abc/def
# Remember: /abc/def is the physical path of /xyz, i.e., the server
# has a 'Alias /xyz /abc/def' directive e.g. #
RewriteEngine On
# let the server know that we were reached via /xyz and not
# via the physical path prefix /abc/def
RewriteBase /xyz
# now the rewriting rules
RewriteRule ^oldstuff\.html$ newstuff.html
Does these lines:
# Remember: /abc/def is the physical path of /xyz, i.e., the server
# has a 'Alias /xyz /abc/def' directive e.g. #
mean that
mod_rewrite sets Alias /xyz /abc/def'
automatically based on the .htaccess file or show this be specified explicitly in the conf file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它不会自动设置别名:您需要显式定义它在您的服务器配置中,而不是 .htaccess
It does not set the Alias automatically: you need to explicitly define it in your server config, not .htaccess