CodeIgniter Forums
How to redirect URLs with '?' but no query string parameters - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: How to redirect URLs with '?' but no query string parameters (/thread-49443.html)



How to redirect URLs with '?' but no query string parameters - El Forum - 02-20-2012

[eluser]Unknown[/eluser]
Hi,
I was using Codeigniter for my site which was hosted on GoDaddy earlier. For some reason, the standard CI URLs didn't work as expected.
e.g. - http://domain.com/controller/function/param
Hence I had to update one of the core CI libraries such that it generates URL in the form - http://domain.com/index.php?controller/function/param

Now all the URLs cached in google are in the format mentioned above.
I have now changed the host and also upgraded my CI installation to 2.0.3.
The new host supports standard SEF URLs.
What I need to achieve is get rid of the index.php segment from the URL which can be easily done using htaccess. Though I need to ensure that all the google cached URLs redirect to corresponding new URLs without index.php? segment. For example -

http://domain.com/index.php?album redirects to
http://domain.com/album

Can anyone please help me out with it?

Regards,
shreyas.ab


How to redirect URLs with '?' but no query string parameters - El Forum - 02-20-2012

[eluser]InsiteFX[/eluser]
Something like this.
Code:
Place this code in your .htaccess file:
redirect 301 /old/old.php http://www.you.com/new.php



How to redirect URLs with '?' but no query string parameters - El Forum - 02-21-2012

[eluser]Unknown[/eluser]
Thanks for the reply. Though I tried it but it unfortunately doesn't work for the rule below -
redirect 301 /index.php?album http://www.you.com/album