.htaccess文件无法正常工作在本地主机上的XAMPP机上、地主、无法正常、文件

2023-09-02 09:46:09 作者:逍遥※神话

我在使用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]