Redirecting subdomain to its sub folder, Safari showing too many redirect occured trying to open

271 views Asked by At

Possible Duplicate

I did the same. But instead of using .htaccess I put these lines

RewriteEngine On
RewriteCond %{HTTP_HOST} ^one\.domain\.com  
RewriteRule ^(.*)$ /folder/$1 [R=301]

to /etc/apache2/sites-available/default.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

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

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride All
        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


        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^one\.domain\.com  
        RewriteRule ^(.*)$ /folder/$1 [R=301]
</VirtualHost>

After restarting apache2, When I browse one.domain.com , Mozzila, IE Chrome not responding, But safari gives error

Safari Error

1

There are 1 answers

1
chrismarinic On BEST ANSWER

Since it's a 301 you're telling the browser to redirect to one.domain.com/folder which still passes your host condition. Meaning on redirect 2 you're on page one.domain.com/folder/folder