0

OLD ---> NEW

http://abc.com/cities/view/1 -->http://abc.com/melbourne-day-tours/

http://abc.com/categories/view/3 -->http://abc.com/melbourne-day-tours/great-ocean-road-tours

http://abc.com/tours/view/1 -->http://abc.com/melbourne-day-tours/great-ocean-road-tours/great-ocean-road-adventure-tour

i do have an old project , now i have to do following redirection , what should i do ? using htaccess ? or any other ways ?

when i put http://abc.com/melbourne-day-tours/ in my bro, the url in the address bar shd be stay same, and it be call controller and the action for http://abc.com/cities/view/1 thanks

2 Answers 2

2

The best way of of doing this is using the CakePHP Router. You can set routes in app/Config/routes.php, for example:

Router::connect(
    '/melbourne-day-tours',
    array('controller' => 'cities', 'action' => 'view', 1)
);

If you are planning having many routes you might be better of using slugs which are stored in your database. There is some information about that in the link above.

Sign up to request clarification or add additional context in comments.

4 Comments

can i do it with using htaccess in cake ?
CakePHP already uses htaccess to rewrite URLs so it's not a good idea.
ya i know but i dont know the specific controller or action names ! i want Quick job - that this shd be redirect to this !
I gave you one example, it's not difficult to adapt it for the other URLs. The "old" URLs you posted are all in the same format: http://example.com/controller/action/id. You should check the manual for more info about working with CakePHP.
0

What i just done is :

i just done is just putted lines in app/webroot/.htaccess

RewriteRule ^melbourne-day-tours/?$ /cities/view/1 [L]

it worked ! thanks !

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.