【问题标题】:.htcaccess in Apache not workingApache中的.htaccess不起作用
【发布时间】:2015-04-29 15:16:39
【问题描述】:

我启用了 mod_rewrite 并希望将我的本地虚拟主机网站之一重定向到 google.com 以进行练习。

我在我的虚拟目录 (/var/www/example.com/.htcaccess) 中创建了一个 .htcaccess 文件,并通过将以下代码添加到 /sites 中的虚拟主机 (example.com) 配置中来授予 .htcaccess 权限- 可用/。

 <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
 </Directory>

我现在尝试通过向 .htcaccess 文件添加代码来使用 mod_rewrite,但到目前为止还没有成功。有什么方法可以检查 .htcaccess 是否正常工作?如果是,如何使用 mod_rewrite 进行重定向?

【问题讨论】:

    标签: linux apache .htaccess rewrite


    【解决方案1】:

    有错别字。通常文件名是.htaccess,而不是.htcaccess

    另一种选择是将文件名设置为“个人风格”,例如:

     AccessFileName .htcaccess 
    

    http://httpd.apache.org/docs/2.2/howto/htaccess.html

    【讨论】:

      猜你喜欢
      • 2012-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-03
      • 2017-11-27
      • 1970-01-01
      • 2022-01-23
      • 2013-12-16
      相关资源
      最近更新 更多