WordPress.org

Ready to get started?Download WordPress

Forums

Auto redirect when www is in the URL (5 posts)

  1. lelandmcfarland
    Member
    Posted 3 years ago #

    I have come across a problem on my MU installation where my primary blog will automatically redirect to the home page when www is in the URL removing anything after the domain. Ex. http://www.domain.com/subfolder/ would redirect to http://domain.com/. This problem does not effect the domains that I added on with MU work fine in this regard, only the primary site is effected. Is anyone else having any problems with this?

  2. Hmm. I can reproduce this oddly.

    Physical subfolders are fine but virtual ones are not.

  3. lelandmcfarland
    Member
    Posted 3 years ago #

    Well I am glad that I am not crazy.

  4. Try putting this in your .htaccess, at the top, above the WP rules.

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

    That will redirect BEFORE it calls whatever WP is doing to munch the content. Works on my box.

  5. lelandmcfarland
    Member
    Posted 3 years ago #

    Thanks. Works great.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags