WordPress.org

Support

Support » Multisite » Blog posts and pages redirecting to homepage

Blog posts and pages redirecting to homepage

  • When I setup multisite, I decided to keep my site URL to include the www. Basically, anytime a user types in the URL of my homepage in their browser as a non-www, it will redirect to the www version, which is how I want it.

    However, for the URLs of individual blog posts and pages, when non-www is entered, it redirects to the homepage and not the blog post or page itself.

    Any idea how to fix this? I imagine I have to setup a rewrite rule in the htaccess file?

Viewing 1 replies (of 1 total)
  • And that’s reason #2 why I advocate NOT using www. *sigh* (Web servers are just plain inconsistant.)

    If you’re not mapping domains, OR using Subdomains, try this:

    # Redirect non-www urls to www
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.example\.com
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]

    If you are using Subdomains, try this:

    # Redirect non-www urls to www
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]

    If you’re using mapped domains, it’s a nightmare, and just map both www and non-www versions of the URL, set the www as primary and let the plugin sort it out.

Viewing 1 replies (of 1 total)
  • The topic ‘Blog posts and pages redirecting to homepage’ is closed to new replies.