CodeIgniter Forums
.htaccess redirect from old links to new links - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: .htaccess redirect from old links to new links (/showthread.php?tid=27363)



.htaccess redirect from old links to new links - El Forum - 02-08-2010

[eluser]diridam[/eluser]
Hello,
i have ported my site to ci and i want to 301 redirect all the old links to the new URI format of CI
for example when someone uses www.site.com/file.php?site=3344 i want to redirect him to www.site.com/controller/function/3344

i have searched all over for a .htaccess rule to help me do this but with no success.

thanks for help


.htaccess redirect from old links to new links - El Forum - 02-22-2010

[eluser]diridam[/eluser]
anyone can help me with this ?

thanks


.htaccess redirect from old links to new links - El Forum - 02-22-2010

[eluser]n0xie[/eluser]
Take a look here


.htaccess redirect from old links to new links - El Forum - 02-22-2010

[eluser]diridam[/eluser]
[quote author="n0xie" date="1266862887"]Take a look here[/quote]

Thanks for the pointing, i ended up having the same errors as the guy in that thread.

i want to rewrite vote.php?id=number in site.com/ci/controller/function/id

i underline that i used the tweak to remove index.php from the codeigniter's default uri scheme. (of course through mod_rewrite)

i don't know why, but when i access site.com/ci/vote.php?id=number it gives me a 404 error page instead of redirecting me to the site.com/ci/controller/function/id.... basically CI looks for vote.php and it doesn't find it ....
i added this rule RewriteRule ^vote.php?id=(.*)$ index.php/vote/take/$1 [L,R=301] above all other rules in my htaccess, even above the rewritebase.. which in my case is /ci/


thanks !


.htaccess redirect from old links to new links - El Forum - 03-04-2010

[eluser]n0xie[/eluser]
I spend some time investigating the problem. Take a look at my explanation in the other thread why my first solution wasn't working.