php - 将某些内容从子域重定向到不同的域
问题描述
尽管这是与 Wordpress 相关的,但这个概念离这里讨论的距离还很远。
我有一个子域:blog.bla.com 我在这个子域上有数百篇文章,需要将其中一些重写到一个新域:bla.com/newPosts
使用 .htaccess 301 重定向我对该主题的研究表明我应该能够简单地说:
Rewrite 301 "blog.bla.com/test/article" "bla.com/test/article
但这不起作用。Wordpress 的可用 (php) 插件也无法在子/域之间传输。
任何帮助表示赞赏。
解决方案
将此规则添加到 blog.bla.com .htaccess 文件的顶部
RewriteEngine On
RewriteRule ^test/article$ http://bla.com/test/article [R=301,L]
RewriteRule ^test/article2$ http://bla.com/test/article2 [R=301,L]
RewriteRule ^test/article3$ http://bla.com/test/article3 [R=301,L]
推荐阅读
- sql - SQL:按日期选择所有数据更改(从历史表中)
- java - 如何从未初始化的活动中更改对象的字段
- ios - 自定义页脚视图没有响应我的点击手势识别器标签
- java - 在 Netbeans 中增加输出和菜单的字体大小的问题
- powerbi - 需要公式在 power bi 报告中应用
- reactjs - 我想知道这是否真的是使用 onAuthStateChanged 的正确方法
- angular - 为什么命令“npm-install”会在根文件夹中安装文件
- ms-access - 在 MS Access 2016 中,您可以创建一个复选框或是/否字段,以与满足特定条件的其他复选框同步吗?
- java - 如何更改 log4j2 中的滚动附加程序时间间隔?
- jdbc - Database connection failed with JDBC to SAP Hana