CodeIgniter Forums
Redirecting my old .html pages - 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: Redirecting my old .html pages (/showthread.php?tid=42670)



Redirecting my old .html pages - El Forum - 06-14-2011

[eluser]maulik13[/eluser]
My old website was built in html and now I am replacing that with codeigniter website.
So my urls have changed as well. I want to redirect old urls with 301, but I am not sure about the implementation.

Old urls
http://example.com/html/porfolio-fineart.html
http://example.com/html/porfolio-animation.html
http://example.com/html/some-page.html

All my new urls are in CodeIgniter structure without .html extension
http://example.com/portfolio/fineart

How do you suggest I redirect my old pages to new ones?

Thanks.


Redirecting my old .html pages - El Forum - 06-15-2011

[eluser]maulik13[/eluser]
As I understand, one option is to use routing to map my url such that some-page.html becomes the parameter for the function.

Any suggestion regarding this ?


edit:
Routing method worked. It was very simple actually.

$route['html/(:any)'] = "home/oldstuff/$1";


Redirecting my old .html pages - El Forum - 06-15-2011

[eluser]toopay[/eluser]
Also, you can set suffix at config file, so that your new uri still have .html extension.


Redirecting my old .html pages - El Forum - 06-15-2011

[eluser]maulik13[/eluser]
Thanks for the tip. I am not sure if I will add suffix to my new pages.