我有一个用户通过动态子域访问的webapp,例如user1.example.com。 这些是通过public_html / example.com / index.php
处理的如何向www.example.com和example.com请求加载public_html / example.com / www / index.php?
我尝试使用规则将所有www.example.com重写为example.com,但L参数似乎没有做我认为会做的事情。我可以看到它重定向到example.com,但它似乎尝试加载public_html / example.com / index.php而不是public_html / example.com / www / index.php。
这是我当前的文件:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?example\.com)$ [NC]
RewriteRule .? http://%1%{REQUEST_URI}/www/index.php [R=301,L]
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]