Im searching the whole web but i dont find a solution for my problem.
My server is debian 7.7 with apache2.2. I have a lot of vhost and one SSL cert. All Domains are pointing to the same directory (/var/www/www). For example i have the following domains:
- www.domain.gv.at
- www.domain.at
- www.example.at
- www.anotherexample.at
I would moving all .htaccess stuff to their vhost.
First of all i would redirect www.domain.gv.at www.domain.at domain.gv.at domain.at to https. My .htaccess file looks like that:
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]
also I would like pretty URL (i.e. https://www.domain.at/cool/page) so i have the following in my .htaccess
RewriteRule ^/typo3$ - [L]
RewriteRule ^/typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* /index.php
Now I'm trying to copy all in my vHost config without success. My vHost (port 80) looks like that:
<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>
my vhost for 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>
But it doesn't work. Some ideas?
Goals - delete .htaccess (I don't want to use it) - redirect domain.at and domain.gv.at to https:// - use pretty urls for typo3
thanks allot