URL重写显示找不到对象404找不到、重写、对象、URL

2023-09-02 09:53:39 作者:偷偷亲伱尐嘴メ

我有一个链接的http://本地主机/ CSS /字典信= A ,我想让它像这样 HTTP:/ /本地主机/ CSS /词典/ A

I have a link http://localhost/css/dictionary?letter=a which I want to make it like this http://localhost/css/dictionary/a

但不知何故,说404的消息

but somehow it says 404 message

我失去了一些东西呢?这是我的code在.htaccess请帮助我。

Am i missing something here? this is my code in .htaccess please help me.

RewriteEngine On
RewriteBase /css/


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^.]+)$ $1.php [NC]


RewriteRule ^([a-zA-Z])$ dictionary?letter=$1

我已经冲刷所有的YouTube视频和阅读文章,至今IM仍然处于困境,请我需要你的帮助。

I've been scouring all the youtube videos and reading articles and so far im still in trouble please i need your help.

推荐答案

这是因为你有2规则,第一个先匹配(因为它比第二个更普遍)。

It's because you have 2 rules, and the first one matches first (as it is more general than the second).

在所有的第二甚至不检查词典

The second doesn't even check for dictionary at all.

第二个条件应该是:

RewriteRule ^dictionary/([a-zA-Z])$ dictionary.php?letter=$1
 
精彩推荐