WordPress.org

Ready to get started?Download WordPress

Forums

URL Redirects Without www. Go to Main Network Homepage (8 posts)

  1. truelux
    Member
    Posted 1 year ago #

    Not sure what's going on but I installed my multisite with the "www", along with the directory site option. So my urls look like:

    http://www.networksite.com/site1/
    http://www.networksite.com/site2/
    http://www.networksite.com/site3/

    The problem is, when visiting any of the sites without the "www", for example - http://networksite.com/site1/, it will just redirect to http://www.networksite.com/

    It's a fresh install and my .htaccess file looks like this:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    
    # END WordPress

    anyone know what's going on with this?

    thanks!

  2. Do you have no_blog_redirect set in your wp-config.php?

  3. truelux
    Member
    Posted 1 year ago #

    No, nothing like that there.

  4. Well. The most likely culprit is that one. Darn. Second is that your server is configured that way :/

    I would put this in the top of my .htaccess:

    RewriteEngine on
    Options +FollowSymLinks
    RewriteCond %{HTTP_HOST} ^!www\.domain\.tld$ [NC]
    RewriteRule ^(.*)$ http://www.domain.tld/$1 [R=301,L]

    That will force it before it hits WP.

  5. truelux
    Member
    Posted 1 year ago #

    I know this is going to sound weird but, am I supposed to leave it as "domain" or replace that with the site's domain? If I replace it, it doesn't work... which I thought was kind of weird.

    Plus, the above code works on FireFox but not on Chrome? Chrome still redirects it back to the primary network domain.

    thanks

  6. Replace domain and tld with whatever yours are. So mine would be

    RewriteEngine on
    Options +FollowSymLinks
    RewriteCond %{HTTP_HOST} ^!www\.halfelf\.org$ [NC]
    RewriteRule ^(.*)$ http://www.halfelf.org/$1 [R=301,L]
  7. truelux
    Member
    Posted 1 year ago #

    Thanks... I did that but it still redirects back to the primary domain.

    However, the htt://primary.com, redirects to add the www.

  8. However, the htt://primary.com, redirects to add the www.

    Okay.. so what's not working?

    You mean that http://primary.com redirects to http://www.primary.com then everything under that (http://primary.com/foobar) should also redirect.

    Can you possibly share your real URLs?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags