1
無效的目錄,我有以下的Apache配置:htaccess的 - 關於301重定向和虛擬主機
<VirtualHost *:80>
ServerName files.example.com
ServerAlias files.example.com dev.files.example.com
DocumentRoot /var/www/example/files
</virtualHost>
和我的.htaccess有:
RewriteCond %{HTTP_HOST} ^(.*)old-example.com [NC]
RewriteRule ^(.*)$ http://%1example.com/$1 [R=301,L]
但是,如果我指出我的瀏覽器files.old-example.com/myfile-1.2.zip
它重定向到files.example.com/files/myfile-1.2.zip
,顯然我得到一個404
,因爲files
目錄不存在/var/www/web/files
內。
我該如何重定向到files.example.com/myfile-1.2.zip
?請假定相同的情況適用於不同的子域。