Welcome Guest, Not a member yet? Register   Sign In
Url rewrite uri problem
#1

[eluser]mathg[/eluser]
Hi,

I have a small problem with my url rewrite to remove index.php. When I use an url like www.mysite.com/fr and I var_dump $RTR->uri I get this :

Code:
["keyval"]=> array(0) { }
["uri_string"]=> string(0) ""
["segments"]=> array(0) { }
["rsegments"]=> array(2) { [1]=> string(4) "main" [2]=> string(5) "index" }
...
["index_page"]=> string(0) ""
["uri_protocol"]=> string(4) "AUTO"
...

The uri object doesn't find any segment event though theres one.

When I use an url like www.mysite.com/index.php/fr

Code:
["keyval"]=> array(0) { }
["uri_string"]=> string(3) "/fr"
["segments"]=> array(1) { [1]=> string(2) "fr" }
["rsegments"]=> array(2) { [1]=> string(4) "main" [2]=> string(5) "index" }
...
["index_page"]=> string(0) ""
["uri_protocol"]=> string(4) "AUTO"
...

This time it finds an uri.

Why isn't it able to find an uri when there is not index.php in the url?

I'm using rewrite engine as follow in my .htacess.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|phpinfo\.php|public|gestion|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Thanks for the help!
#2

[eluser]dudeami0[/eluser]
Code:
RewriteRule ^(.*)$ /index.php?/$1 [L]

That might do the trick.
#3

[eluser]mathg[/eluser]
It did the trick! Thank you very much!

I thought I copied the rule from mod_rewrite wiki, but it looks like no since I forgot that question mark after the index.php... So much time lost for so little...

Thx again!
#4

[eluser]dudeami0[/eluser]
Yeah, when your looking at code all day things like that can fly way over your head :p




Theme © iAndrew 2016 - Forum software by © MyBB