巧妙使用Domain Mirror Plugin插件让您的WordPress博客支持多域名访问

您是不是想让多个域名同时指向一个博客?每个域名的标题还各不相同?并且所有的文章均以各自的域名的地址存在而非其他插件的自动指向主域名?

现在就让Domain Mirror来帮您实现这一梦想吧。

下面是其作者页面的详细说明(英文的!我将在近期以最简单的方式来加以说明!)

(简单地说就是已经支持2.7版了,首先是下载插件安装,启用,然后在设置菜单中找到Domain Mirror项,按提示依次输入您想停靠的域名,标题、小标题、博客显示url(填两次),最后,最重要的也就是你必须将这些域名停靠在购买空间的主域名上--在DreamHost空间是通过mirror项来解决!)--祝您好运!

Wordpress 2.7: Works.
Wordpress 2.6.2: Works.
Wordpress 2.6.1: Works.
Wordpress 2.5: DomainMirror seems to work with no changes on this version, as long as the 2.3 patch is in place.

Download: Domain Mirror v1.1

Download: Domain Mirror v1.2beta

Download: WP-DomainMirror WordPress 2.3 fix

If you have more than one domain and want to point both of them at the same WordPress installation, you’ll find that it doesn’t really work very well. Wordpress creates it’s own internal URLs based on the settings in General Options. This Plugin allows multiple domains to be configured within WordPress and updates the Weblog Title, WordPress Address URL and Blog Address URL on-the-fly based on the value of $_SERVER['SERVER_NAME'].

This allows one installation to show different URL paths, tagline and blog title for each domain.

What it won’t do is make one domain appear to be two, or change your domain configuration. You need to do that yourself, or have your hosting provider do it for you.

To see it in action, you can access this site via http://McAleavy.org or http://LightPainting.org. Both point to a single WordPress installation, running on a single database.

NB: It doesn’t appear to work with WordPress MU.

New in v1.1

  1. You can now have a separate tagline on each domain.
  2. The Admin screen has a button to copy in the current Wordpress configuration to save on typing.
  3. The Admin screen has buttons to clear content from whole domains and indivudual lines.

New in v1.2beta

This version is pretty new, contains quite a few changes, and may have bugs. Please use it if you’d like to help find them.

  1. Theme switching.
  2. SERVER_NAME / HTTP_HOST config option.
  3. “no admin screen” switch.
  4. More validation.
  5. Added “stripcslashes”

Installation

  1. Download and unpack the archive. If you downloaded the plugin from my site it will unpack to a directory named “AA-DomainMirror”, but if you got it from the Wordpress plugin repository it will unpack to the direcotory “domain-mirror”. Either will work, but you may need to rename the latter to “AA-DomainMirror” if you have problems with some other plugins not seeing the changes. See below.
  2. Copy the whole AA-DomainMirror directory to wp-content/plugins/ If possible, don’t change the name of the directory, as the AA- at the start is a horrible hack to ensure that Wordpress loads this plugin first. This is required as any plugin loaded before it won’t be able to see the changes it makes, so will behave as if it’s still on the default domain. This puzzled me for quite a while.
  3. Go to your Plugins page and activate Domain Mirror.
  4. Go to the Options -> Domain Mirror page and configure as outlined below.

Upgrade

Overwrite the old version with the new version.

Usage

When enabled, Domain Mirror will change the values of Weblog Title, Tagline, Wordpress Address and Blog Address automatically. Where you have hard-coded the site name or a site URL into a post or page you should replace that entry with one of the tags provided. See below.

Configuration

Click the images to expand.

You will need to set up at least 2 domains that point to the same WordPress install. With Apache you can do that with Virtual Hosts. If you are using a hosted account there may be some way to set this up through the account configuration screens. On the host I use for this site, DreamHost, you do this by logging into the Panel interface and selecting Domains >> Manage Domains. Your first domain must be Fully Hosted. For the Domain you want to set as the Mirror, click the edit button. In the edit screen there are 5 options:

  1. Fully Hosted;
  2. Redirected;
  3. Mirrored;
  4. Parked;
  5. Cloaked.
DreamHost Mirror Settings

DreamHost Mirror Settings

 

Select the Mirrored option, and set Domain to mirror to the name of your Fully Hosted domain. Shown here is this setting for my lightpainting.org domain, which mirrors mcaleavy.org.

Options Before

Options Before

 

Your existing Wordpress configuration should be left as it is. This will not be changed unless you press Save on this page when viewed from a domain other than the default. See below.

Domains Before

Domains Before

 

On initial activation, the Domain Mirror options screen will display a default blank entry. This default is defined in conf.inc.php – which can be edited to set different defaults. The post tags used to display the current setting of these fields in posts or pages are shown to the right. Add this text to a post or page and it will be replaced by it’s value for the current domain. This allows such posts to display properly from any configured domain.

First Domain

First Domain

 

Fill in the settings for the current domain, or press the Get Current Domain button to get the values from the database. This is recommended because the General Options page will show the Domain Mirror configured settings when accessed from another domain. If you then press Save on that page those options will be written to the Wordpress settings, overwriting the original settings. If you don’t have those settings in Domain Mirror, they will be lost and the original domain will not function properly until they are re-entered. If Save is not pressed, the original values will be retained and will be used again when the plugin is disabled.

Changes Saved

Changes Saved

 

Click the Save button to record the changes. The screen will reload and display the Changes Saved banner.

New Blank Domain

New Blank Domain

 

To add another domain, click the Add New Domain button. The page will refersh with a 2nd blank domain.

Second Domain

Second Domain

 

Fill in the details for the 2nd domain, and click Save Changes.

SiteBefore.jpg

SiteBefore.jpg

 

Now, when viewed using the first domain, the site remains unchanged.

Site After

Site After

 

When viewed using the second domain, the site appears as if configured for that domain.

Options After

Options After

 

The General Options screen, when accessed from the new domain, now displays the details for that domain. These options, however, are coming from the Domain Mirror configuration and not from the Wordpress settings. As noted before, if save is pressed on this page these options will be written to the Wordpress settings, overwriting the original settings. If you don’t have those settings in Domain Mirror, they will be lost and the original domain will not function properly until they are re-entered.

To delete a domain, press the Delete Domain button and it will be removed from the page. This change will be written to the database when you next press Save Changes. If you delete all of the entries in Domain Mirror it will return to it’s default settings. If you wish to alter these defaults you can edit the file config.inc.php in the AA-DomainMirror directory. The “X” buttons on each line can be used to clear the contents of that line and the Clear All button can be used to clear the contents of that domain setting. Again, pressing Save Changes is rquired to make these changes permanent.

Related posts:

  1. Google已经正式推出了Google Site-任何人均可申请,可绑定域名! 据Google官方博客报道,Google现在已经正式推出了Google Site,任何人都可以快速建立网站,分享所有类型的信息,包括团队项目、公司内部网、社区团体、教室、俱乐部、家庭等,你可以将其共享给几个人、一群人或者所有人。  你可以免费建立一个类似 http://sites.google.com/site/freewsite/ 这样的网站,并免费增加任何你喜欢的内容。  使用Google Sites非常容易,你可以点按钮创建不同类型的页面,你还可以在页面嵌入文件、日历、相片、影片和小工具等等,和Google Docs一样,系统内置了所见即所得的编辑器,一旦你的网站建立好,你可以输入电子邮件邀请其他人来编辑或者浏览你的内容,你可以决定哪些人有编辑权限。关于绑定域名:Changing the site URL for...
  2. Google已经正式推出了Google Site-任何人均可申请,可绑定域名! 据Google官方博客报道,Google现在已经正式推出了Google Site,任何人都可以快速建立网站,分享所有类型的信息,包括团队项目、公司内部网、社区团体、教室、俱乐部、家庭等,你可以将其共享给几个人、一群人或者所有人。   你可以免费建立一个类似 http://sites.google.com/site/freewsite/ 这样的网站,并免费增加任何你喜欢的内容。   使用Google Sites非常容易,你可以点按钮创建不同类型的页面,你还可以在页面嵌入文件、日历、相片、影片和小工具等等,和Google Docs一样,系统内置了所见即所得的编辑器,一旦你的网站建立好,你可以输入电子邮件邀请其他人来编辑或者浏览你的内容,你可以决定哪些人有编辑权限。 关于绑定域名: Changing...
  3. 永远免费的*.tc顶级域名-http://www.smartdots.com提供 登录地址:http://www.smartdots.com/ Features With a domain from smartdots™ you receive a...
  4. WordPress.com.cn – 为你提供WordPress免费博客 WordPress.com.cn – 为你提供WordPress免费博客 WordPress.com.cn为用户提供WordPress免费博客服务,采用著名的WordPress MU博客程序系统,功能强大,操作方便。不支持绑定域名,不支持插件,有1000余个模板可供选择,1000M存储空间,无广告。注意:WordPress.com.cn不是官方网站,和WordPress.com没有任何关系。虽然现在WordPress.com已经解封了,但就怕不知什么时候又被封掉了,两难的抉择啊! 网址:http://wordpress.com.cn申请后会给你发邮件,点最长的链接激活就开通了。登陆后台点“Settings”,页面最下部“Blog language:”后面选“Chinese”就可改为中文版了。 ...
  5. File2HD-可在线轻松下载网页上的flash等文件的免费网站 File2HD 是一个号称可以从任何网站上下载任何文件的网站“Download any file from any site”,虽然描述的有些夸大,但还是个简单并且好用的网页服务。通过File2HD只要输入想下载网页的网址,该网站就能自动将网页中的音乐、影片、图片、插件、flash等文件给抽离出来,方便你直接下载。地址:http://www.file2hd.com通过File2HD下载Flash游戏的使用方法:1、打开你要下载的Flash游戏网站到网址,复制网址。2、复制网页的网址并将其粘贴到File2HD上。3、打勾“I have read and...

以上关联文章由 Yet Another Related Posts Plugin 提供支持。