简体   繁体   English

Drupal重定向-子域到域

[英]Drupal redirect - subdomain to domain

I Have a drupal 7 website with a plain domain: example.com . 我有一个drupal 7网站,其域名很简单:example.com。

I have another server with apache2 for creating static webpages and hotsites in a subdomain: content.example.com . 我有一台带有apache2的服务器,用于在子域中创建静态网页和热点:content.example.com。

Would be ever possible to redirect specific pages from my subdomain, for example: content.example.com/2014/special to my root domain , like example.com/special ? 是否有可能将特定页面从我的子域重定向,例如:content.example.com/2014/special到我的根域,例如example.com/special?

Many thanks in advance 提前谢谢了

使用.htaccess文件重写URL。

You can do this using .htaccess files. 您可以使用.htaccess文件执行此操作。 Ex: 例如:

RewriteCond %{HTTP_HOST} ^content\.example\.com/2014/special$ [NC]
RewriteRule ^(.*)$ http://example.com/special [R=301,L]

Haven't tested, but pretty sure that works. 还没有测试,但是可以肯定的。 Correct me if I am wrong. 如果我错了,请纠正我。

make a file called .htaccess (make sure it is not .htaccess.txt), and put it in the directory of the page you want to redirect. 创建一个名为.htaccess的文件(确保它不是.htaccess.txt),并将其放在您要重定向的页面的目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM