.htaccess文件无法正常工作在本地主机上的XAMPP [英] .htaccess file not working on localhost XAMPP

查看:133
本文介绍了.htaccess文件无法正常工作在本地主机上的XAMPP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用XAMPP和也.htaccess文件在本地主机的PHP项目:

I have PHP project on localhost using XAMPP and also .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /locations/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /test.php [L]
</IfModule>

但是,这是不工作的,我只是得到错误404在httpd.conf文件我注释掉这一行:

But this is not working and I am only getting Error 404. In httpd.conf file I have uncommented this line:

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride All

我使用的是Windows 8.1。我能做些什么,使其工作,好吗?

I am using Windows 8.1. What can I do to make it work, please?

推荐答案

您可以使用根的.htaccess规则:

You can use this rule in root .htaccess:

RewriteEngine On
RewriteBase /

RewriteRule ^locations(/.*)?$ test.php [L,NC]

这篇关于.htaccess文件无法正常工作在本地主机上的XAMPP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆