Digital site
Digital site

Reputation: 4447

codeigniter - redirect page

codeigniter recently is real pain even though it is easy to understand and handle. however, sometimes it is horrible. I was trying to redirect a page using Tank_auth and whenever the redirect happen, a ? shows up in the url. on my localhost everything is ok, but on my web server this weird ? comes out from nowhere.

any idea how to get rid of this ? question mark??

Thanks

Update #1

I thought maybe someone is going to ask about the .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php? [NC,L]

Update #2

This is the redirect code:

function room()
{
    if (!$this->tank_auth->is_logged_in()) {
        redirect('/hit/two/');
    } else { bla blah

Upvotes: 0

Views: 1119

Answers (2)

Digital site
Digital site

Reputation: 4447

I found the answer myself. I had to edit the config file at the codeigniter where you can activate or deactivate query string feature. I made False and the redirect worked 100% without ? symbol. I hope someone find this useful. thanks

Upvotes: 0

stealthyninja
stealthyninja

Reputation: 10371

Change

RewriteRule ^.*$ index.php? [NC,L]

to

RewriteRule ^(.*)$ index.php?/$1 [NC,L]

Upvotes: 1

Related Questions