WordPress.org

Ready to get started?Download WordPress

Forums

multisite & 301 redirects (3 posts)

  1. timdcva
    Member
    Posted 1 year ago #

    I upgraded an existing WP install to a multisite recently, and I noticed that it changed the way I was redirecting some URLs

    I have this code in my htaccess file:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^decorativeconcreteofva.com$ [OR]
    RewriteCond %{HTTP_HOST} ^decorativeconcreteofcentralvirginia.com$ [OR]
    RewriteCond %{HTTP_HOST} ^decorativeconcreteva.com$ [OR]
    RewriteCond %{HTTP_HOST} ^decorativeconcretevirginia.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.decorativeconcreteofva.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.decorativeconcreteofcentralvirginia.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.decorativeconcreteva.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.decorativeconcretevirginia.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.decorativeconcreteofcentralva.com$ [OR]
    RewriteCond %{HTTP_HOST} ^decorativeconcreteofcentralva.com$
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301]

    but for some reason, it still redirects everything as a 302.

    This was working fine before I upgraded to multi-site.

    Any suggestions?

    Tim

  2. timdcva
    Member
    Posted 1 year ago #

    Also- when I change the above code to this;
    RewriteCond %{HTTP_HOST} !=www.decorativeconcreteofvirginia.com [NC]
    
RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]

    It changes all the re-directs to 301, but it also stops any multi-site subdomains from working properly.

    Any help would be greatly appreciated.

    Thanks!

    Tim

  3. timdcva
    Member
    Posted 1 year ago #

    I tried this too:

    RewriteCond %{HTTP_HOST} decorativeconcreteofva.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} decorativeconcreteofcentralvirginia.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} decorativeconcreteva.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} decorativeconcretevirginia.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} http://www.decorativeconcreteofva.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} http://www.decorativeconcreteofcentralvirginia.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} http://www.decorativeconcreteva.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} http://www.decorativeconcreteofcentralva.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]
    RewriteCond %{HTTP_HOST} decorativeconcreteofcentralva.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]

    And its giving a 301 properly... but when I add this:
    RewriteCond %{HTTP_HOST} decorativeconcreteofvirginia.com$ [NC]
    RewriteRule ^(.*)$ http://www.decorativeconcreteofvirginia.com/$1 [R=301,L]

    I get an error in a web browser that says there are too many redirects.

    When I remove those last 2 lines, something in wordpress is redirecting everything to http://www.decorativeconcreteofvirginia.com with a 302 redirect.

    Im so confused. It seems like the wordpress install is redirecting it somehow... I just dont know where to go to change it to a 301.

    Tim

Topic Closed

This topic has been closed to new replies.

About this Topic