在一个.htaccess文件很多的RewriteBase?

问题描述:

我有一个域名和一个单词$ P $同一台服务器上PSS-博客。现在我有一个问题(惊喜)。这个词preSS位于/ httpdocs资料/博客/域名指向/ httpdocs资料/而我想它重定向到/ httpdocs资料/域/。但是,obvisiously,我在Word preSS固定链接。

I have a domain and a wordpress-blog on same server. Now I have a problem (surprise). The wordpress is located on /httpdocs/blog/ and domain is pointing to /httpdocs/ and I'm trying to redirect it to /httpdocs/domain/. But, obvisiously, I have permalinks in Wordpress.

下面是我当前的.htaccess:

Here's my current .htaccess:

RewriteEngine On

RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

RewriteBase /
RewriteCond %{HTTP_HOST} domain.com
RewriteCond %{REQUEST_URI} !^/domain
RewriteCond %{REQUEST_URI} !^/cgi-bin
RewriteRule ^(.*)$ domain/$1 [L]

但是,正如你已经propably认为,这是行不通的。字preSS'固定链接会影响到/域/还,所以我的图片和其他的URL出错。

But as you already propably assumed, this doesn't work. Wordpress' permalinks affects to /domain/ also, so my images and other urls go wrong.

有什么建议?是否有可能使用的RewriteBase这样吗?

Any advice? Is it possible to use RewriteBase like this?

没有,你只能有一个基本的URL。只需重写规则:

No, you can only have one base URL. Just rewrite your rules:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/. /blog/index.php [L]

RewriteCond %{HTTP_HOST} =example.com
RewriteCond %{REQUEST_URI} !^/domain
RewriteCond %{REQUEST_URI} !^/cgi-bin
RewriteRule ^(.*)$ domain/$1 [L]