.htaccess doesn#39;t work on xampp (windows 7)(.htaccess 不适用于 xampp(Windows 7))
本文介绍了.htaccess 不适用于 xampp(Windows 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在正在设置我的 .htaccess
文件以使用 friendly urls(手动).但是,当我转到 url 时,服务器会显示 Error 404.
I'm setting my .htaccess
file right now to use friendly urls (manually). But, when i go to the url the server shows me Error 404.
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
Rewriterule ^register$ register.php
我很确定 mod_rewrite 已启用,因为我在使用 phpinfo()
时看到了它.
I'm really sure that mod_rewrite is enabled because i see it when use phpinfo()
.
推荐答案
即使 mod-rewrite
已启用,默认情况下 .htaccess
文件并未启用.
Even though mod-rewrite
is enabled, by default it is not enabled for .htaccess
files.
屏住呼吸
- 打开xampp控制面板
- 停止 Apache
- 单击 Apache 行上的
Config
按钮,然后选择httpd.conf
- 在该文件中,搜索类似
xampp/htdocs">
- 再低一点,你可能会看到这样的一行:
# AllowOverride All
.去掉#
,这是一个注释 - 或者,搜索
AllowOverride All
,确保它在正确的部分,然后删除注释#
- 保存文件
- 重启 Apache,祈祷,交叉手指,屏住呼吸
- Open xampp control panel
- Stop Apache
- Click the
Config
button on the Apache row, and selecthttpd.conf
- In that file, search for something like
xampp/htdocs">
- A bit lower, you may see a line like this:
# AllowOverride All
. Remove the#
, which is a comment - Alternately, search for
AllowOverride All
, make sure it is in the right section, and remove the comment#
- Save the file
- Restart Apache, say a prayer, cross your fingers and hold your breath
这篇关于.htaccess 不适用于 xampp(Windows 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:.htaccess 不适用于 xampp(Windows 7)
基础教程推荐
猜你喜欢
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01