我正在尝试/admin
使用以下两行将所有调用重定向到子域.htaccess
:
RewriteCond %{REQUEST_URI} ^admin [NC]
RewriteRule ^(.*)/$ http://admin\.somedomain\.com/$1/ [R,L]
好吧,什么也没有发生。它只是忽略重定向规则并显示 /admin 目录的内容。
仅供参考(并跳过粘贴我的整个.htaccess
文件的请求),这里是:
Options +FollowSymlinks -Indexes
RewriteEngine on
Redirect 404 /favicon.ico
RewriteCond %{REQUEST_URI} ^admin [NC]
RewriteRule ^(.*)/$ http://admin\.somedomain\.com/$1/ [R,L]
# Send all admin. traffic to /admin
RewriteCond %{HTTP_HOST} ^admin\. [NC]
RewriteRule ^(.*)$ /admin/$1 [L]
# Check for www. and add it
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^admin\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R,L]
# Add trailing slash if not found
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !favicon.ico
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [R,L]
# Process virtual links/directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !favicon.ico
RewriteRule ^(.*)$ index.php/?$1 [QSA,L]