mod_rewrite 是否自动设置“Alias”,还是应该在执行“RewriteBase”时显式指定?

发布于 2024-12-27 07:02:35 字数 934 浏览 4 评论 0原文

来自: RewriteBase Apache 文档

        #  /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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

長街聽風 2025-01-03 07:02:35

它不会自动设置别名:您需要显式定义它在您的服务器配置中,而不是 .htaccess

It does not set the Alias automatically: you need to explicitly define it in your server config, not .htaccess

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文