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

时间:2012-01-14 21:42:40

标签: apache .htaccess mod-rewrite url-rewriting apache2

来自: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 

这些行:

        #  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文件中明确指定?

1 个答案:

答案 0 :(得分:2)

它不会自动设置Alias:您需要在服务器配置中明确定义它,而不是.htaccess