tried to 301 redirect pages to another domain but an error appears

Hello All,

I tried to 301 redirect pages from this site agastone.com to this site agastone.hu

First I put this:
RewriteCond %{HTTP_HOST} ^agastone.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.agastone.com [NC]
RewriteRule ^(.*)$ http://agastone.hu/$1 [L,R=301,NC]

Which has worked perfectly !
But when I wanted to redirect all the main pages, an error appeared when I visit the pages: Website entered a redirecting loop !

This is what I have used to redirect the pages:
Redirect 301 / http://agastone.hu/
Redirect 301 /termekek/ http://agastone.hu/termekek/
Redirect 301 /termekek/akcios-termekek/ http://agastone.hu/termekek/akcios-termekek/
Redirect 301 /termekek/falburkolatok/ http://agastone.hu/termekek/falburkolatok/
Redirect 301 /termekek/koburkolatok/ http://agastone.hu/termekek/koburkolatok/
Redirect 301 /termekek/parkanyok/ http://agastone.hu/termekek/parkanyok/
Redirect 301 /referenciak/ http://agastone.hu/referenciak/
Redirect 301 /kivitelezes/ http://agastone.hu/kivitelezes/
Redirect 301 /kofaragas/ http://agastone.hu/kofaragas/
Redirect 301 /about-us/ http://agastone.hu/about-us/
Redirect 301 /blog/ http://agastone.hu/blog/

Right after the code I have mentioned above. What could be the problem? what to do about it?

Many thanks
Ahmad

  • hostunion01

    For the agastone.com (the domain being redirected)

    # BEGIN W3TC Browser Cache
    <IfModule mod_deflate.c>
    <IfModule mod_headers.c>
    Header append Vary User-Agent env=!dont-vary
    </IfModule>
    AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
    # DEFLATE by extension
    AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
    </IfModule>
    # END W3TC Browser Cache
    # BEGIN WordPress
    <IfModule mod_rewrite.c>

    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

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

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

    </IfModule>

    # END WordPress

    I just deleted the redirect 301 for pages, because the error was appearing on those pages

    For agastone.hu

    # BEGIN W3TC Browser Cache
    <IfModule mod_deflate.c>
    <IfModule mod_headers.c>
    Header append Vary User-Agent env=!dont-vary
    </IfModule>
    AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
    # DEFLATE by extension
    AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
    </IfModule>
    # END W3TC Browser Cache
    # 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

  • Vaughan

    Hi Ahmad,

    If all the pages are the same paths on the new domain, you could try something like this instead of using redirect.

    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^(.*)$ http://agastone.hu/$1 [R=301,L]

    So that should then redirect 301

    http://agastone.com/termekek/ to http://agastone.hu/termekek/

    http://agastone.com/any-page/any-path to http://agastone.hu/any-page/any-path and so on.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.