htaccess的重写子域

问题描述:

您好我有一个在主服务器的一个子目录位于一个独立的网站。

Hi I have a independent site that sits within a sub-directory of a main server.

子目录网站内点到根的所有链接,我想捕捉那些,并将它们发送回子目录,而不是根目录。

All links within the sub-directory site point to the root and I'd like to capture those and send them back to the sub-directory rather than the root.

这可能与htaccess的?

Is this possible with htaccess?

这不会重定向到子目录,但要其他域的行为就好像子目录是文档根。我认为这是更好的。

This will not redirect to the subdir, but make the other domain behave as if the subdir is the document-root. Which I think is even better.

RewriteEngine on
RewriteBase     /

RewriteCond %{HTTP_HOST} ^seconddomain.nl$ [NC]
RewriteCond $1 !^subfolder
RewriteRule ^(.*)$ /subfolder/$1 [L]