Re: Disabling default cakephp routes

2009-06-23 Thread grigri

Just add a rule to your .htaccess:

# If you are using naked UUIDs
RewriteCond %{REQUEST_URI} ^(.*/)entities/view
RewriteRule ^entities/view/([a-fA-F0-9]{32})$ %1$1 [R=301,L]

# If you are using dashed UUIDs
RewriteCond %{REQUEST_URI} ^(.*/)entities/view
RewriteRule ^entities/view/([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]
{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$ %1$1 [R=301,L]

hth
grigri

On Jun 23, 2:31 am, Novice Programmer 
wrote:
> Hello Guys,
>
> I am having an EntitiesController with an action view which expects the uid
> as a parameter(uid of the entity to be viewed). I have created a route in
> the configuration file for this situation like:
>
> Router::connect('/:entity_uid', array('controller' => 'entities', 'action'
> => 'view'),
>             array('pass'=>array('entity_uid')));
>
> so that urls look likehttp://x.com/
> instead ofhttp://x.com/entities/view/
>
> but some how search engine seems to have indexed the second form 
> i.ehttp://x.com/entities/view/ which is problematics since it can
> see two urls pointing to the same page.
>
> Now i am thinking that the default route be given a permanent redirect 
> tohttp://x.com/ but out of ideas on how to accomplish that. Please
> help.
>
> I am using the cake build 1.2.3.8166.
>
> --
> Thanks & Regards,
> Novice.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Disabling default cakephp routes

2009-06-22 Thread Novice Programmer
Hello Guys,

I am having an EntitiesController with an action view which expects the uid
as a parameter(uid of the entity to be viewed). I have created a route in
the configuration file for this situation like:

Router::connect('/:entity_uid', array('controller' => 'entities', 'action'
=> 'view'),
array('pass'=>array('entity_uid')));

so that urls look like http://x.com/
instead of http://x.com/entities/view/

but some how search engine seems to have indexed the second form i.e
http://x.com/entities/view/ which is problematics since it can
see two urls pointing to the same page.

Now i am thinking that the default route be given a permanent redirect to
http://x.com/ but out of ideas on how to accomplish that. Please
help.

I am using the cake build 1.2.3.8166.

-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---