0

我有 assets.domain.com 托管我所有的图像、字体、脚本等,以便在顶级域上安装 Wordpress。我想在不影响文件夹内容的情况下将对子域和文件夹的任何访问重定向到顶级域(很多文件类型,因此希望避免将每个文件类型都列为豁免,但如果这是我唯一的选择,那就这样吧) .

接近:

# Enable URL Rewriting
Options -Indexes
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^(images|type|scripts)(/.*|$) - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/robots.txt
  RewriteCond %{REQUEST_URI} !images/.* [NC]
  RewriteCond %{REQUEST_URI} !type/.* [NC]
  RewriteCond %{REQUEST_URI} !scripts/.* [NC]
  RewriteRule ^(.*)$ http://www\.domain\.com [L,QSA]
</IfModule>

感谢Christopher Brixmootinator

4

0 回答 0