URL重写显示找不到对象404 [英] apache mod_rewrite displays object not found 404

查看:674
本文介绍了URL重写显示找不到对象404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个链接的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

这篇关于URL重写显示找不到对象404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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