Welcome Guest, Not a member yet? Register   Sign In
ROUTES from old site to new
#1

[eluser]ovulator[/eluser]
On my current site I have urls set up like this:

www.site.com/category/6

On the new site I have urls set up like this:

www.site.com/products/pants

Can I uses $ROUTES to 301 redirect to the new urls?

My thought was something like this

Code:
$old_cat_nums = array ('6' => 'pants');
$ROUTE['category/(:any)'] = 'products/'.$old_cat_nums['$1'];

The above code obviously doesn't work, but it gets the jest of what I want to try.

Or am I just going to have to manually enter each using mod-rewrite in htaccess?
#2

[eluser]DarkManX[/eluser]
best way to solve this problem is to edit your controllers⊧ / yours views.
#3

[eluser]Aken[/eluser]
Use a single route to set any incoming number categories to a specific controller method. Then use that method to find the actual URL, and then use redirect() with the 301 HTTP flag included. See the user guide for more info on that.
#4

[eluser]ovulator[/eluser]
Thanks Aken, that worked perfectly!
#5

[eluser]Aken[/eluser]
Excellent. A 301 redirect is the best way to take any old URLs and point them to new ones, and this way keeps you from having to write them all individually in the .htaccess file.




Theme © iAndrew 2016 - Forum software by © MyBB