WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] .htaccess with subdomain non-www to www

[Resolved] .htaccess with subdomain non-www to www

  • hockeyhero4
    Member

    @hockeyhero4

    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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] .htaccess with subdomain non-www to www’ is closed to new replies.