Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have one VM (LAMP) with a static IP. There are two Subdomains configured on this Machine. If i browse one of the subdomains, it executes the files specified in its DocumentRoot. The problem here is there are no sources loaded (CSS, JS, ...) because it loads em from the IP-Addres/Path but that cant be working since i need the subdomain to specify the correct DocumentRoot.

Example:

192.168.10.10 goes to /var/www/

sub.mydomain.com goes to /var/www/sub/
dom.mydomain.com goes to /var/www/dom/

the Scripts loaded by the site on sub.mydomain.com are loaded from 192.168.10.10/css/default.css which obviously can't be working.

Where do i need to place changes to get this working? (Also the Form-Redirects after submitting are mapping to the ServerIP)

Is this part of the VirtualHosts-Section in Apache-Conf or the .htaccess-File?

Apache-Site-Configuration:

   NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName sub.mydomain.com

        ServerAlias sub.mydomain.com

        DocumentRoot /var/www/sub/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

    #RewriteEngine   on
    #RewriteCond     %{SERVER_PORT} ^80$
    #RewriteRule     ^(.*)$ https://%{SERVER_NAME} [L,R]
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName sub.mydomain.com

    ServerAlias sub.mydomain.com

    DocumentRoot /var/www/sub/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/sub/>
        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 /var/log/apache2/error.log

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

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>


    <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/plain text/html text/xml
        AddOutputFilterByType DEFLATE text/css text/javascript
        AddOutputFilterByType DEFLATE application/javascript application/x-javascript
    </IfModule>


        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/wildcard_mydomain.cert
        SSLCertificateKeyFile /etc/apache2/ssl/wildcard_mydomain.key
        SSLCertificateChainFile /etc/apache2/ssl/wildcard_mydomain.intermediate
</VirtualHost>

And my .htaccess-File:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ajax/(.*)$ ajax.php?shform=$1 [QSA,L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?shform=$1 [QSA,L]
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.