Removing the ? from path while using htaccess + QUERY_STRING |
[eluser]Rich Hauck[/eluser]
Wondering if someone could share an htaccess file that removes both index.php and the question mark (?) from a site path while using uri_protocol of QUERY_STRING. Here's my config.php: $config['uri_protocol'] = "QUERY_STRING"; $config['url_suffix'] = ""; Here's my current htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] </IfModule> I've been struggling with this for a few days now (see this forum post) and am hoping I'm closer by asking this question.
[eluser]xwero[/eluser]
Because a question mark is an meta character in regex i guess you have to escape it. index.php\?
[eluser]Rich Hauck[/eluser]
Weird. I tried that, and if I navigate to site.com/ci/?page it's fine, but if I try to navigate to site.com/ci/page it seems to redirect me to site.com and breaks all file/image references on the page.
[eluser]ELRafael[/eluser]
[quote author="Rich Hauck" date="1190229810"]Wondering if someone could share an htaccess file that removes both index.php and the question mark (?) from a site path while using uri_protocol of QUERY_STRING. Here's my config.php: $config['uri_protocol'] = "QUERY_STRING"; $config['url_suffix'] = ""; Here's my current htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] </IfModule> I've been struggling with this for a few days now (see this forum post) and am hoping I'm closer by asking this question.[/quote] Maybe now i understood better our question. You need this kind of url www.site.com/controller/method and not this: www.site.com/index.php/controller/method, right? But what i didn't understand, is why you want uri_protocol = query_string... change to auto and in the .htaccess remove the ?/$1 Code: RewriteRule ^(.*)$ /index.php/$1 [QSA,L] have you tried this?
[eluser]ELRafael[/eluser]
In my webserver too... so, my .htacces is about this: Code: <IfModule mod_rewrite.c> and my /config/config.php: Code: /* i hope works for you...
[eluser]Rich Hauck[/eluser]
Tried it, and I get "The URI you submitted has disallowed characters." when attempting site.com/ci/?page If I try site.com/ci/page Apache gives me a 404.
[eluser]esra[/eluser]
This seems to work on a site setup for query strings when the uri protocol setting is set to AUTO. I would appreciate knowing if it does not work in your case. Code: Options +FollowSymLinks |
Welcome Guest, Not a member yet? Register Sign In |