apache mod_rewrite displays object not found 404

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

but somehow it says 404 message

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

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

Answer1:

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.

The second condition should be:

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

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:apache mod_rewrite displays object not found 404