I couldn’t get my class to work so i did this in the router.php file
I am pretty sure there is another way. If anyone has a solution i would
appreciate it
$move='category/'. stripslashes_deep ($_SERVER['REQUEST_URI']);
Router::redirect('/:slug/*',$move, array('status' => 302));
On Wednesday, September 26, 2012 10:38:14 AM UTC-7, arron wrote:
>
> dynamic html redirects using routers
>
> in the beginning I had no categories and all of my pages were root
>
>
>
> example:
>
>
> http://domain/somepage
>
>
> This was great, but as my content over the years grew I need to
> categorize my content
>
>
> so I added some routes see below
>
> //routes.php
>
>
> Router::connect(
>
>
> "/:category/:slug",
>
> array('controller' => 'controllername', 'action' => 'view'),
>
> array(
>
> 'name'=>'[-A-Z0-9]+',
>
>
> 'pass' => array('category','slug')
>
>
>
> )
>
>
> );
>
>
> //end
>
> this works great and accomplished what I needed to do, but there is one
> problem the search engines .I need to write 301's for all of my links and I
> have over 8K pages.
>
>
>
> The solution cakesphp's Router::redirect
>
>
> The issue I am now having is I cant figurer out how to redirect my old
> links. I can for example redirect all of the links to one category, but
> that wont cut it. I need to redirect all of my links to the new location.
>
>
> I am trying to use routes.php router :: redirect
>
>
> if I do this my code it redirects to the category, but not the slug
>
>
>
> Router::redirect(
>
> '/:slug/*',
>
> array(
>
> 'pass' => array('category/:slug'))
>
>
> result
>
>
> http://domain/category/
>
>
>
> how can I get cake to redirect to
>
>
> http://domain/category/slug ?
>
>
> instead of http://domain/category/
>
>
>
--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.