I currently have the modrewrite:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
Which adds the original request uri into an index.php request path if the file does not exist. With some $_SERVER manipulation, I can then get the request. But it requires a lot of code, since $_SERVER is populated differently between different servers.
I would like to instead separate the url like this. If I have an url:
www.test.com/somedir/foo/bar?this=that
and the htaccess file is located at www.test.com/somedir/, I would like the resulting url to be:
www.test.com/somedir/index.php?r=foo/bar&this=that
on the other hand, if there were no get variables at the end of the original url, like this:
www.test.com/somedir/foo/bar
I would like to get this instead:
www.test.com/somedir/index.php?r=foo/bar
I have tried to play around with this, but just can’t seem to figure it out. Any help would be greatly appreciated.
Try something like this: