bolshi
Goto Top

Non-www auf www-Adresse umleiten unter Apache 2.4.x auf Ubuntu 14.04

Hallo,

aktuell ist unser Drupal7-CMS unter http://domain.de erreichbar. Die soll nun auf http://www.domain.de umleiten.

Unter /etc/apache2/sites-available wurde folgende domain.conf angelegt:

<VirtualHost *:80>
        DocumentRoot /var/www/site1

         ServerName domain.de

        <Directory "/var/www/site1">  

            RewriteEngine On
            RewriteBase /

            RewriteCond %{HTTP_HOST} !^www\. [NC]
            RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

            AllowOverride All
            Require all granted
            Options Indexes FollowSymLinks MultiViews
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>



Die conf-Datei per 'a2ensite domain.conf' aktiviert.

Im Anschluss den Apachen neu geladen 'service apache2 reload'.

Nur wird die Domain nicht umgeleitet.

Content-Key: 323673

Url: https://administrator.de/contentid/323673

Printed on: April 19, 2024 at 21:04 o'clock

Member: SlainteMhath
Solution SlainteMhath Dec 13, 2016 at 08:23:46 (UTC)
Goto Top
Moin,

das geht einfacher face-smile
<VirtualHost *:80>
        ServerName domain.de
        Redirect permanent / https://www.domain.de/
</VirtualHost>1

lg,
Slainte