的.htaccess重写字preSS多站点 [英] .htaccess rewrite WordPress Multisite

查看:109
本文介绍了的.htaccess重写字preSS多站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的服务器我有一个字preSS安装为我自己的公司网站。 除此之外,我想建立一个示范区,为客户。

On my server I've got a single WordPress installation for my own company website. Besides that, I would like to create a demo area for clients.

目前,我已经得到了以下设置和文件夹:

At the moment I've got the following setup and folders:

www.domain.com - 单字preSS安装于公司网站

www.domain.com - Single WordPress installation for company website

www.domain.com/demo/ - 字preSS多站点

www.domain.com/demo/ - WordPress Multisite

目前所有客户的网站具有以下域结构: www.domain.com/demo/client1,www.domain.com/demo/client2等。

At the moment all the clients websites have the following domain structure: www.domain.com/demo/client1, www.domain.com/demo/client2, etc.

相反,那些长期的网址,我想一个子域: demo.domain.com/client1,demo.domain.com/client2等。

Instead of those long urls, I would like a subdomain: demo.domain.com/client1, demo.domain.com/client2, etc.

字preSS多地点的标准生成以下的.htaccess:

WordPress Multisite standard generates the following .htaccess:

RewriteEngine On
RewriteBase /demo/
RewriteRule ^index\.php$ - [L]

RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

从其他主题的计算器我发现了以下内容:

From other topics at stackoverflow I've found the following:

RewriteRule ^demo/(.*) demo.domain.com/$2/

不过遗憾的是,这并不正常工作。如果谁可以帮我? 在此先感谢!

But unfortunately this doesn't work. Anybody who can help me? Thanks in advance!

推荐答案

请在多站点的.htaccess它在哪里,并把此在的.htaccess在Web根目录:

Keep the multisite .htaccess where it is and put this in the .htaccess in the root of your web directory:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^demo
RewriteRule ^(.*)$ http://www.domain.com/demo/$1

这篇关于的.htaccess重写字preSS多站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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