linux - Apache 中的 .htaccess 不工作

标签 linux apache .htaccess url-rewriting

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

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

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

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

最佳答案

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

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

 AccessFileName .htcaccess 

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

关于linux - Apache 中的 .htaccess 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29915978/

相关文章:

linux - 查找 Ubuntu 启动过程中的时间消耗者

python - 使用 easy_install 时出现安装错误

linux - 如何使用动态 grep 模式尾随文件?

php - 使用本地 htaccess 文件 (Apache) 实现内容安全策略

linux - Scheme 中的二次公式

Django 将斜杠附加到 OpenShift 上的静态文件 URL

linux - 来自不同 IP 的 Wordpress 不受控制的提要请求

PHP 错误未显示在浏览器中 [Ubuntu 10.10]

.htaccess - 使用 .htaccess 将非 www URL 重定向到 www

linux - htaccess 将 www 重定向到非 www 不工作