Site migration, before the site is a level two directory, and now to move to a level directory, but before the two level catalog contains a lot of pages, how to use PHP to redirect the two-level directory page to the first level directory? The parameters are the same!
Previously included pages are http://www.caihua.cc/gouwu/cat/3/44/44935 redirected to http://www.caihua.cc/cat/3/44/44935 via PHP
Reply to discussion (solution)
This time with the address rewrite function ...
This time with the address rewrite function ...
Can you post the code? Thank you
Please ask ~! What is the role of sub-catalogue???
See these online:
SEO Note points
1, the directory should not be too deep, 2-3-level directory is preferred.
2, the contents of each directory should be strictly separated,
3, if a complete Web site system in a level directory, such as Bbs,blog,sns, then after a long time or stability, the search engine will consider this directory as a complete site.
4, the same website, such as BBS, put a directory and root directory, Google there, there is no advantage on the too big difference. But Baidu often gives the two level of the weight of the directory is relatively low.
5, the appropriate level of the directory, the main domain can provide a large amount of content, thereby increasing the primary domain weight.
The relationship between the sub-directory and the search ~!!!! And the relationship with the code, ~!!. Can you explain it a little bit??? !
Add the following in your location code:
$urlold = "http://www.caihua.cc/gouwu/cat/3/44/44935";//Your code assembly variables
$urlnew =str_replace ('/gouwu/', '/', $urlold);
Header ("Location: $urlnew");
Rewriterule/(. *)/(. *)/(. *)/(. *)/(. *)/$2/$3/$4/$5/[n,i]
Give it a try.
Add the following in your location code:
$urlold = "http://www.caihua.cc/gouwu/cat/3/44/44935";//Your code assembly variables
$urlnew =str_replace ('/gouwu/', '/', $urlold);
Header ("Location: $urlnew");
Thank you
Change it a little bit.
$urlold = isset ($_server[' Request_uri ')? $_server[' Request_uri ': ';//Your code assembles variable $urlnew=str_replace ('/gouwu/', '/', $urlold); header (' http/1.1 301 Moved Permanently ');//Issue 301 Header Header ("Location: $urlnew");
Indeed, forget the condition to judge.