WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Redirects without www. only go to home page (6 posts)

  1. johnnyflash
    Member
    Posted 2 years ago #

    Hi, we are running WP 3.3.1 Multisite and we have setup a number of Quick Redirects in the main site (at the root) and have specified certain URLs to be redirects to other pages. The problem is that if you don't include www. then it just takes you to the home page and not the specified page. Examples:

    http://fairfax.cc/goodsense redirects to: http://fairfax.cc/communitylife/community-care/good-sense-seminar/
    http://www.fairfax.cc/goodense redirects to: http://fairfax.cc

    This is true for all of our re-directs. Try these with and without http://www.:

    http://www.fairfax.cc/greaterthings
    http://www.fairfax.cc/thejourney
    http://www.fairfax.cc/worship

    How do I fix this?

  2. WPtesting
    Member
    Posted 2 years ago #

    if you don't include www. then it just takes you to the home page and not the specified page.

    It's totally opposite of what you are saying...
    Your site is working fine with non-www, the problem is with www.

    Check your .htaccess code whether there any weird redirection.
    Are you using any kinda plugin, for redirection? if yes, the plugin might be responsible for this issue.

  3. johnnyflash
    Member
    Posted 2 years ago #

    Sorry for the confusion. You're right, I had it backwards. I'll check the .htaccess file. How would I do the redirects in WP without using a redirect plug-in? Some of the redirects are to internal pages and others are to outside addresses. Thanks in advance.

  4. johnnyflash
    Member
    Posted 2 years ago #

    This is my .htaccess file, see anything unusual?

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $1 [L]
    RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress

  5. WPtesting
    Member
    Posted 2 years ago #

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

    Add this rewrite rule on the top of your .htaccess file.

  6. johnnyflash
    Member
    Posted 2 years ago #

    That did the trick! You are awesome! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.