0

I'm pretty new to apache, so probably the solution will be obvious to you... I'm running on Debian wheezy

Here are my two file in /etc/apache2/sites-availables:

amelineandraphael

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName amelineandraphael.raphaelnussbaumer.com

        DocumentRoot /var/www/amelineandraphael
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/amelineandraphael>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

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

zoziology

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName zoziologie.raphaelnussbaumer.com

    DocumentRoot /var/www/zoziologie
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/zoziologie>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

  • I have added a symbolic link to /etc/apache2/sites-enables
  • I've run sudo a2ensite amelineandraphael and sudo a2ensite zoziologie
  • and restart the apache server.

The sub-domain zoziologie.raphaelnussbaumer.com is working but amelineandraphael.raphaelnussbaumer.com redirect me to the default index.html at /var/www/.

Here are the .htaccess of /var/www/amelineandraphael:

SetEnv PHP_VER 5_4

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Any idea ?

Rafnuss
  • 119
  • 1
  • 14

2 Answers2

1

I think I found the solution. Although I'm not sure that's the only part of the solution:

sudo a2dissite 000-default
Rafnuss
  • 119
  • 1
  • 14
0

Unfortunately I can't comment yet as I don't have the rep, so sorry about this being an "answer".

I'm wondering if you have a DNS "A" record for that subdomain? You may have a wildcard DNS record though, which would make this a moot point

e_i_pi
  • 4,590
  • 4
  • 27
  • 45
  • I'm running on Debian wheezy and I do have DNS "A" for both subdomain which both point to the same IP adress (of my server VPS). And there is not wildcard DNS record. thanks for the help – Rafnuss May 27 '16 at 07:20
  • You've run "sudo a2ensite amelineandraphael.raphaelnussbaumer.com" and then "sudo service apache2 reload"? (Sorry if the syntax is wrong, I'm used to Ubuntu) – e_i_pi May 27 '16 at 07:24
  • I've run `sudo a2ensite amelineandraphael`, which return `Site amelineandraphael already enabled`. But `sudo a2ensite amelineandraphael.raphaelnussbaumer.com`, return `ERROR: Site amelineandraphael.raphaelnussbaumer.com does not exist!` – Rafnuss May 27 '16 at 07:29
  • 1
    It looks like there's a redirect to www.amelineandraphael.raphaelnussbaumer.com. Have you checked your .htaccess in /var/www and subdirectories? – e_i_pi May 27 '16 at 07:41
  • I've added it above. .htaccess of zoziologie look identical expect of the first line of PHP version. there are no .htaccess in the root /var/www. – Rafnuss May 27 '16 at 07:47
  • e_i_pi is right, there is a redirect to www.amelineandraphael.raphaelnussbaumer.com, and it is not form .conf nor from .htaccess, so it has to be from the app itself. Check the [wordpress settings](https://codex.wordpress.org/Changing_The_Site_URL) – Dusan Bajic May 27 '16 at 08:02