使用特定的目录通配符子域名 [英] Using wildcard subdomain on specific directory

查看:258
本文介绍了使用特定的目录通配符子域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设立一个现有的字preSS安装到使用多节点。我已经成功地建立了网络,并因为这是现有的安装使用的子域(我想反正)。

我已经创建了我的网络上的一个新的网站/子域所以它会是这个样子example.domain.com

我遇到越来越通配符子域设置我的托管服务提供商BlueHost的。

问题

我承载多个域,所以当我安装一个通配符它总是指向根或原来的IP地址。

我需要它指向根的特定目录,以便它使用正确的单词preSS安装。根/特定目录

有没有办法来实现这一目标?我不是太熟悉和CNAME问题。如果有一种方法通过写htaccess的,这将是好得去实现它。

解决方案
  

我承载多个域,所以当我安装一个通配符它总是指向根

我假设你的意思是,你得到的 example.domain.com 相同的内容,如果你是来访 www.domain.com 。这可以肯定通过的htaccess 重写规则来处理。

如果名为子网站一个子域是须送达 $ {DOCUMENT_ROOT} /子网站目录,您将添加以下规则到你的的.htaccess 放置在Web根 / 目录:

  RewriteEngine叙述上
的RewriteBase /

的RewriteCond%{HTTP_HOST} ^子网站\。域\ .COM $ [NC]
的RewriteCond%{REQUEST_URI}!^ /子网站[NC]
重写规则^(。*)$ /子网站/ $ 1 [L]
 

如果有需要重定向几个mutisite子域,使用下面的动态规则来代替:

  RewriteEngine叙述上
的RewriteBase /

的RewriteCond%{HTTP_HOST} ^(?!万维网\。)([^。] +)\。域\ .COM $ [NC]
的RewriteCond%{REQUEST_URI} ::%1!^ /([^ /] +)。*?:: \ 1
重写规则^(。*)$ / 1%/ $ 1 [L]
 

您还需要添加 ServerAlias​​ * .domain.com &LT;虚拟主机&gt;在Apache的配置的httpd.conf 文件<$ C C $>。


看来BlueHost的不占用任何请求修改的httpd.conf 直接为您服务。但是,他们提供一种方式来设置一个的通配符子域名从他们的控制面板的。

看看<一href="http://www.markleobongcasan.com/blog/how-to-set-up-a-word$p$pss-multisite-in-bluehost-dealing-with-multisite-installation-problem-in-bluehost/"相对=nofollow>如何设置一个字preSS多点会议的BlueHost的。最后一节概述了屏幕截图的过程。您还需要启用每个网站的主题为你的子域。

I am setting up an existing wordpress install to use multisite. I have successfully set up the network and since it was an existing install it uses subdomains (which I wanted anyways).

I have created a new site/subdomain on my network so it would look something like this example.domain.com

The issue I am running into is getting wildcard subdomains setup on my hosting provider BlueHost.

I am hosting multiple domains so when I setup a wildcard it always points to the root or original ip address.

I need it to point to a specific directory of the root so it uses the correct wordpress install. root/specific-directory

Is there a way to achieve this? I am not too familiar with a and cname issues. If there is a way to achieve it by writing in the htaccess that would be okay too.

解决方案

I am hosting multiple domains so when I setup a wildcard it always points to the root

I'm assuming you meant that you get the same content for example.domain.com as if you were visiting www.domain.com. This can surely be handled through htaccess rewrite rules.

If a sub-domain named subsite was to be served out of ${DOCUMENT_ROOT}/subsite directory, you would add the following rules to your .htaccess placed at your web root / directory:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^subsite\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/subsite [NC]
RewriteRule ^(.*)$ /subsite/$1 [L]

If there are several mutisite subdomains that need redirection, use the following dynamic rules instead:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI}::%1 !^/([^/]+).*?::\1
RewriteRule ^(.*)$ /%1/$1 [L]

You would also need to add ServerAlias *.domain.com to your <VirtualHost> configuration in Apache's httpd.conf file.


It seems BlueHost doesn't take up any requests to modify httpd.conf directly for you. But, they do provide a way to setup a wildcard subdomain from their Control Panel.

Take a look at How to Set Up a WordPress MultiSite in Bluehost. The last section outlines the process with screen shots. You also need to enable theme per site for your subdomains.

这篇关于使用特定的目录通配符子域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆