简体   繁体   English

子域重定向(htaccess)

[英]Sub domain redirect (htaccess)

There is soooo much information about htaccess redirect that I think I'm lost. 关于htaccess重定向的信息太多,我认为我已经迷路了。 Here is my current structure 这是我目前的结构

  • /web/ / web /
  • /web/CMS/ / web / CMS /

In the root I have a vBulletin forum and in /CMS/ I have wordpress. 在根目录下,我有一个vBulletin论坛,在/ CMS /中,我有wordpress。 (Ideally I should have vBulletin in a /FORUM/ folder maybe?) (理想情况下,我应该在/ FORUM /文件夹中有vBulletin吗?)

I'd like to setup something like this: 我想设置以下内容:

www.domain.com OR domain.com goes to /web/CMS/ www.domain.com或domain.com转到/ web / CMS /

forum.domain.com OR forums.domain.com goes to /web/ forum.domain.com或forums.domain.com转到/ web /

Then any other subdomain goes to /web/CMS/ (as I'll be using the multi site network of Wordpress) 然后,其他任何子域都转到/ web / CMS /(因为我将使用Wordpress的多站点网络)

I have 2 questions: 我有两个问题:

  1. What would be the best structure for this? 最佳的结构是什么? Maybe I should have my CMS as root and my forum in a folder? 也许我应该将CMS作为root用户并将我的论坛放在文件夹中?

  2. How can I do an htaccess that does the job? 我该如何做才能做到的htaccess? (do I also need one in /web/CMS/?) (在/ web / CMS /中我还需要一个吗?)

Thank you so much in advance. 提前非常感谢您。

If you have vBulletin in your root and you want it to go to forums, you should consider moving it into it's own directory called /forums. 如果您的根目录中有vBulletin,并且您希望它进入论坛,则应考虑将其移至它自己的目录/ forums中。 Inside the /forums directory, you'll have a .htaccess file generated by vBulletin. 在/ forums目录中,您将拥有一个由vBulletin生成的.htaccess文件。

You can keep your WordPress inside /CMS. 您可以将WordPress保留在/ CMS中。 WordPress will and should have its own htaccess file. WordPress将并且应该有自己的htaccess文件。

Now if you want to set a subdomain, you'll have to look into your DNS settings and at a minimum setup an A record. 现在,如果要设置子域,则必须查看DNS设置,至少要设置一个A记录。 If you're on cPanel, this is pretty simple to do inside your DNS Zone section. 如果您使用的是cPanel,则在“ DNS区域”部分中执行此操作非常简单。

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

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