开发者

How to redirect from former CakePHP page a non-CakePHP page using .htaccess

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 th开发者_JAVA技巧e database) that did not end in a slash-number have directed OK.

Any ideas what is going wrong?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜