I am in the process of deploying a new site which needs 301 redirects setup for existing links indexed by Google.
Can anyone suggest how using the routes feature & regular expression I force any links to use the new 301 redirect.
E.g. a route
$route['hotel/pages/([a-z0-9_-]+)//\.htm$/'] = 'hotel/page/redirect/$1/$2';
So i’d like any pages that following the following structure:
site.com/hotel/pages/somesection/page.html
to use another controller where i’ll setup the 301 redirect (I can do this bit)
Can anyone give me some suggestions?
This should do (built a quick local test and it worked):
:any(a CI’s thing) is much like/\w+/iso it matches anything in the 3rd segment, and remaps to the$1; then you have a slash and then any character, repeated more times, and ending in ‘.html’, which remaps to$2