.htaccess 301站点重定向
刚刚为客户端构建了一个新站点,旧站点的URL结构基本上是/index.php?pageid=1、/index.php?pageid=2等等 如何在所有遗留页面上设置重定向 当前站点使用domain.com/blog-post、domain.com/contact等.htaccess 301站点重定向,.htaccess,redirect,http-status-code-301,.htaccess,Redirect,Http Status Code 301,刚刚为客户端构建了一个新站点,旧站点的URL结构基本上是/index.php?pageid=1、/index.php?pageid=2等等 如何在所有遗留页面上设置重定向 当前站点使用domain.com/blog-post、domain.com/contact等 感谢您的帮助根据页数,a可能是您想要的: RewriteMap oldtonew txt:/path/to/file/map.txt RewriteRule ^/index.php?pageid=([0-9]+) ${oldtone
感谢您的帮助根据页数,a可能是您想要的:
RewriteMap oldtonew txt:/path/to/file/map.txt
RewriteRule ^/index.php?pageid=([0-9]+) ${oldtonew:$1}
map.txt的内容:
1 /blog-post
2 /contact
3 /foo
4 /bar
编辑
如果只想将所有旧页面重定向到一个新页面,则无需重新编写地图:
RewriteRule ^/index.php?pageid=([0-9]+) /path/to/new/page
谢谢你提供的信息,这个网站以前很深,所以我认为地图绘制太多了。我们希望做的是,如果可能的话,将所有以前的链接重定向到主页。@Brob:啊,这样做会简单得多。用另一个例子更新了答案。