.htaccess url重写问题

.htaccess url重写问题,.htaccess,.htaccess,在过去的两个小时里,我一直在努力解决这个问题,并试图自己解决它。我做不到 所以。。。我想将我的URL(www.domain.com/article/hello)重写为www.domain.com/article/read/hello,但我似乎无法理解。 我当前的.htaccess: Options +FollowSymLinks RewriteEngine On RewriteBase / #problem here RewriteRule ^article\/(.*)$ index.php/

在过去的两个小时里,我一直在努力解决这个问题,并试图自己解决它。我做不到

所以。。。我想将我的URL(www.domain.com/article/hello)重写为www.domain.com/article/read/hello,但我似乎无法理解。 我当前的.htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

#problem here
RewriteRule ^article\/(.*)$ index.php/article/read/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#this has to stay the same and it's actually working
RewriteRule ^(.*)$ index.php/$1 [L]

如果我尝试重定向一个不按预期工作的规则(在规则中添加了R)->一切正常,但这不是重点,我不希望它重定向。

你的
.htaccess
对我有效,我认为它对你也有效,因为你说如果你用重定向来做,它也会有效

我添加了该规则,并转到
localhost/article/hello
,然后添加了
echo$\u服务器['PATH\u INFO'
到my index.php的顶部只是为了测试,我得到了
/article/read/hello


也许你在index.php中使用了类似于
REQUEST\u URI
的东西,其中包含
/article/hello
而不是
PATH\u INFO
,这就是为什么它似乎不起作用的原因?

我在错误的地方找了两个小时。啊。。谢谢,更改了我的请求,现在效果很好!