开发者

301 redirect for php site on windows

i have the following scenario:

old site, hosted somewhere. all pages except homepage are in the form of:

mydomain.com/page123 or some other number of course..

new site ,written in php, hosted on different server, a windows plan (cannot change that..)

all pages including ho开发者_如何学Cmepage are in the form of:

mydomain.com/?page=some_name or

the idea is not loose the old pages rank so i was re commended to use 301 redirect

goal: all old urls should redirect to mydomain.com/?page=homepage problem(?): can't use htaccess on new server (tried, it doesn't not work)

php has:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>

but where would i place this code? the old files are not present on the new site.

am i missing something here? any suggestions?

Thanks and have a nice day :-)


It depends on your site structure. If you use MVC approach with one entering point like index.php you can add this code in your route controller and check that you get old url try to move to new url with header.

If you use another approach you should add redirect conditions in your apache/nginx server for each old pages.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜