-1

I was finally able to duplicate my Magento store and now i'm able to develop in/with git.
The Copy is stored in /var/www.dev
So i thought i duplicate my apache/site-available/shop to dev.shop in the same folder, change the configuration from ServerName shop.com to dev.shop.com and that should be enought.

Unfortunatly all my requests for dev.shop.com become redirected to shop.com, and i can't figure out why.
Logs say it is a 302 redirect. So it cant be a Javascript, and since it is before the php stuff will run it has to be the apache Server.

Here is some config.
/etc/apache2/sites-available/shop.com

<VirtualHost *:80>
ServerAdmin it@shop.com
ServerName www.shop.com
ServerAlias shop.com

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order Allow,Deny
</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

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>
</VirtualHost>
<VirtualHost *:443>
    ServerAdmin it@shop.com
    ServerName www.shop.com
    ServerAlias shop.com
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/shop.com.crt
    SSLCertificateKeyFile /etc/apache2/ssl/shop.com.key
    SSLCACertificateFile /etc/apache2/ssl/SSL_CA_Bundle.pem

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order Allow,Deny
    </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_ssl.log

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

    CustomLog ${APACHE_LOG_DIR}/access_ssl.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>
</VirtualHost>

And this is the /etc/apache2/sites-available/dev.shop.com

<VirtualHost *:80>
    ServerAdmin it@shop.com

    ServerName dev.shop.com
    ServerAlias dev.shop.com dev shop.com

    DocumentRoot /var/www.dev
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www.dev/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order Allow,Deny
    </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>
<VirtualHost *:443>
    ServerAdmin it@shop.com

    ServerName www.dev.shop.com
    ServerAlias dev.shop.com

    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/shop.com.crt
    SSLCertificateKeyFile /etc/apache2/ssl/shop.com.key
    SSLCACertificateFile /etc/apache2/ssl/SSL_CA_Bundle.pem

    DocumentRoot /var/www.dev
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www.dev/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order Allow,Deny
    </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_ssl.log

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

    CustomLog ${APACHE_LOG_DIR}/access_ssl.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>
</VirtualHost>
Harrys Kavan
  • 402
  • 1
  • 5
  • 19
  • 1
    What makes you certain that the PHP scripts aren't being run? It's entirely possible to have a cgi script output a new `Location:` which will create a redirect and a log with the status 302 in it. – Jenny D Jan 31 '13 at 14:00
  • Thanks Jenny, your comment made me think again about it. I had caching activaed when i copied the Store. So it thought his "base_url" would be without the subdomain. And yes i changed it before in the Database. – Harrys Kavan Jan 31 '13 at 14:18

1 Answers1

1

Since your dev config file

/etc/apache2/sites-available/dev.shop.com

has

AllowOverride All

in the settings for the directory

/var/www.dev/

something else you might check for is whether your site is using Redirects in .htaccess

Look for the presence of this file

/var/www.dev/.htaccess

that contains entries with some version of Redirect in it. It may be sending browsers that visit the dev host on to the production one. This can happen when you simply copy all the files in the web root, or use some version control system to get the code deployed in both places not realizing that the .htaccess file has those Redirects.

If so, you just need to adjust the redirect rules to redirect to the dev site.