views:

48

answers:

1

I have some redirects in place from our previous site that used CakePHP. The new site has plain PHP pages. When trying to redirect the following in an .htaccess file I am having problems:

Redirect 301 /old-page-here http://samesitename.com/somedirectory/newfilename.php

The /old-page-here had the extension .ctp. When I run this in my browser I get a loop with newfilename.php appearing over and over again (as well as the other webaddress information - but not repeated).

I was having a similiarish problem with when CakePHP put page numbers in, e.g.

Redirect 301 /olddirectory/old-page-here/2 http://samesitename.com/somedirectory/newfilename-2.php

When it would add both directories into the webaddress. Redirecting pages that were within the webroot directory (pulled from the database) that did not end in a slash-number have directed OK.

Any ideas what is going wrong?

A: 

Hello Adam,

maybe this could come in handy for building your new urls. As for your trouble with redirecting when cakephp was still installed: I can imagine that this is somewhat complicated to achieve from "outside", as somewhere in the process cake's dispatcher dissolves the address into controller,action, parameters. From the "inside", you can do redirects with a status code.

Kind regards, Benjamin.

benjamin
Great - used RedirectMatch 301 and seems to have done the job. Many thanks, Adam
Adam Lund