For the last 2 hours I have been fighting with this problem and trying to figure it out by myself. Coudn’t do it.
So… I would like to rewrite my URL (www.domain.com/article/hello) to http://www.domain.com/article/read/hello, but I cann’t seem to figure it out.
My current .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]
If I try to redirect the Rule that isn’t working as it was supposed to (added R in the rule) -> Everything works alright, but that’s not the point, I don’t want it to redirect.
Your
.htaccessworks for me, I think it also works for you since you say it works if you do it with a redirect.I added that rule and go to
localhost/article/helloand then addedecho $_SERVER['PATH_INFO'];to the top of my index.php just to test and I got/article/read/helloMaybe you’re using something like
REQUEST_URIwhich contains the/article/helloinstead ofPATH_INFOinside your index.php and that’s why it seems like it’s not working?