gpt4 book ai didi

.htaccess RewriteEngine 不工作

转载 作者:行者123 更新时间:2023-12-02 23:51:20 24 4
gpt4 key购买 nike

我有这个.htaccess:

RewriteEngine On
RewriteRule ^/test$ /home.php

那么 mysite.com/home.phpmysite.com/test 现在应该是相同的吗?
但是当我访问 mysite.com/test 时,我收到 404 错误。

有什么帮助吗?

最佳答案

这是因为您的规则中存在前导斜杠。

将其更改为:

RewriteEngine On
RewriteRule ^test/?$ /home.php [L,NC]

.htaccess 是每个目录配置,因此 Apache 在匹配 URI `/test1

时不匹配前导 /

引用:Apache mod_rewrite Introduction

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

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