WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] .htaccess with subdomain non-www to www (2 posts)

  1. hockeyhero4
    Member
    Posted 1 year ago #

    I understand the basics of non-www to www versions of a website through the htaccess but what normally works isn't working in this case.

    Here's what's happening:

    -http://sub.domain.com is working fine
    -http://www.sub.domain.com - returns a "Website Suggestions" screen.

    How do I get this to work correctly? I've tried 3 or 4 different non-www to www htaccess tactics. If it matters this website is on GoDaddy servers.

    Here's what I'm currently using

    # protect the htaccess file
    <files .htaccess>
    order allow,deny
    deny from all
    </files>
    
    # protect wpconfig.php
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    rewritecond %{http_host} ^DOMAIN-NAME [nc]
    rewriterule ^(.*)$ http://www.sub.domain.com/$1 [r=301,nc]
    </IfModule>
    
    # END WordPress
  2. hockeyhero4
    Member
    Posted 1 year ago #

    Was a host problem with GoDaddy - switched to Bluehost and everything worked just fine.

Topic Closed

This topic has been closed to new replies.

About this Topic