我在搜索整個網絡,但我沒有找到我的問題的解決方案。vHost和SSL mod_rewrite
我的服務器是Debian 7.7的apache2.2。我有很多vhost和一個SSL證書。所有域指向相同的目錄(/ var/www/www)。例如我有以下結構域:
- www.domain.gv.at
- www.domain.at
- www.example.at
- www.anotherexample.at
我會將所有.htaccess的東西移動到他們的虛擬主機上。
首先,我會將www.domain.gv.at www.domain.at domain.gv.at domain.at重定向到https。我的.htaccess文件看起來像這樣:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.gv\.at [NC,OR]
RewriteCond %{HTTP_HOST} ^domain\.gv\.at [NC,OR]
RewriteCond %{HTTP_HOST} ^domain\.at [NC]
RewriteRule ^(.*)$ https://www.domain.at/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
也是我喜歡漂亮的URL(即https://www.domain.at/cool/page),所以我有我的.htaccess
RewriteRule ^/typo3$ - [L]
RewriteRule ^/typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* /index.php
現在我想所有複製以下我的vHost配置沒有成功。我的虛擬主機(80端口)看起來像這樣:
<VirtualHost *:80>
ServerName www.domain.at
ServerAlias domain.at domain.gv.at www.domain.gv.at
DocumentRoot /var/www/www/
ErrorLog /var/log/apache2/www.domain.at-error.log
CustomLog /var/log/apache2/www.domain.at-access.log vhost_combined_ip
<Directory /var/www/www>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.gv\.at [NC,OR]
RewriteCond %{HTTP_HOST} ^domain\.gv\.at [NC,OR]
RewriteCond %{HTTP_HOST} ^domain\.at [NC]
RewriteRule ^(.*)$ https://www.domain.at/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
RewriteRule ^/typo3$ - [L]
RewriteRule ^/typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* /index.php
</Directory>
</VirtualHost>
我對SSL虛擬主機
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/domain.crt
SSLCertificateKeyfile /etc/apache2/ssl/domain.key
SSLCertificateChainFile /etc/apache2/ssl/COMODOSSLCA.crt
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
SSLProtocol ALL -SSLv2
SSLHonorCipherOrder On
SSLCipherSuite AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH
SSLInsecureRenegotiation off
ServerName www.domain.at
ServerAlias domain.at domain.gv.at www.domain.gv.at *.domain.at
DocumentRoot /var/www/www/
ErrorLog /var/log/apache2/domain.at-error.log
CustomLog /var/log/apache2/domain.at-access.log combined
<Directory /var/www/www>
Options FollowSymLinks MultiViews -Indexes
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
但它不工作。一些想法?
目標 - 刪除的.htaccess(我不想使用它) - 重定向domain.at和domain.gv.at到https:// - 用漂亮的網址,TYPO3
感謝配發