Rewrite url using htaccess with parameter

My original url is test.com/a/b/index.php/index/sub?query1=1&query2=2.

I want to rewrite it to: test.com/a/b/cate/1/2.

I am using htaccess with these lines:

RewriteEngine on
RewriteBase /a/b
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^cate/([0-9]+)/([0-9]+)$ index.php/index/sub?query1=$1&query2=$2 [L,QSA,NC]

      

This does not work. I do not know why. Can anyone please help?

Edit: I am using CodeIgniter.

+3


source to share


1 answer


I edited this varriable in config: $ config ['uri_protocol'] in PATH_INFO and now it works. I know this is weird, but it doesn't work if the default is REQUEST_URI.



0


source







All Articles