htaccess 301 重定向

发布于 2024-11-03 01:26:43 字数 350 浏览 10 评论 0原文

我以前有一个 WordPress 博客,后来删除了。现在我在谷歌搜索结果中有很多我的旧博客网址。这里有一个免费的例子,

http://mywebsite.com/2011/01/3360
http://mywebsite.com/2011/06/3450
http://mywebsite.com/2011/02/3456
http://mywebsite.com/2010/01/3547
http://mywebsite.com/2010/02/2264

我如何重定向所有以 2010 和 2011 开头的死网址。如果我必须将每个 url 输入到 htaccess 文件中,我的 htaccess 文件会变得很长。

i used to have a wordpress blog and removed it. Now i have a lot of my old blog urls in Google search results. Here are a fre examples

http://mywebsite.com/2011/01/3360
http://mywebsite.com/2011/06/3450
http://mywebsite.com/2011/02/3456
http://mywebsite.com/2010/01/3547
http://mywebsite.com/2010/02/2264

How can i redirect all dead urls that start with 2010 and 2011 in it. My htaccess file would get very long if i had to input each url into the htaccess file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱本泡沫多脆弱 2024-11-10 01:26:43

在您的 .htaccess 文件中包含以下规则:

RewriteEngine on
Options +FollowSymlinks -MultiViews

RewriteRule ^201[01]/ /my-new-page [R=301,L]

Have this rule in your .htaccess file:

RewriteEngine on
Options +FollowSymlinks -MultiViews

RewriteRule ^201[01]/ /my-new-page [R=301,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文