gpt4 book ai didi

php - .htaccess 文件不适用于本地主机 XAMPP

转载 作者:可可西里 更新时间:2023-11-01 13:47:07 24 4
gpt4 key购买 nike

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

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

但这不起作用,我只收到错误 404。在 httpd.conf 文件中,我取消了这一行的注释:

# 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。请问我该怎么做才能让它发挥作用?

最佳答案

您可以在 root .htaccess 中使用此规则:

RewriteEngine On
RewriteBase /

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

关于php - .htaccess 文件不适用于本地主机 XAMPP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27657810/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com