Mod rewrite mod#u rewrite:don';不要重写任何子域

Mod rewrite mod#u rewrite:don';不要重写任何子域,mod-rewrite,singlepage,Mod Rewrite,Singlepage,在mod_rewrite中有没有一种方法可以免除对子域的任何请求?现在,我有一个单页的应用程序,可以将所有内容重定向到index.html <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI

在mod_rewrite中有没有一种方法可以免除对子域的任何请求?现在,我有一个单页的应用程序,可以将所有内容重定向到index.html

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !index
  RewriteRule (.*) index.html [L]
</IfModule>

选项+FollowSymlinks
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}!指数
重写规则(.*)index.html[L]

但是我想确保对subdomain.mydomain.com的调用永远不会被重写。

您可以使用子域上的条件和
-
替换来停止重写。从

有一个名为“-”的特殊替换字符串,它的意思是:否 替代!这在提供重写规则时非常有用 匹配URL,但不替换任何内容

试一试

RewriteEngine On

RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.com$ [NC]
RewriteRule .* - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]