0

My .htaccess file looks like this

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

# 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>

# END WordPress

if i remove the rules for the non www to www and go to my site test.com it works fine, but as soon as I enable the rewriteengine on to change test.com to www.test i get server not found.

Please note I also ran sudo a2enmod rewrite and I get Module rewrite already enabled

1 Answer 1

0

It sounds like you don't have a DNS entry for www.test.com. You need to make sure that resolves to the same IP address as test.com does.

3
  • you mean create an A record for www.test.com with the same IP ? Jan 30, 2014 at 3:39
  • @VarunSheth yeah, A or CNAME pointing to test.com, either one
    – Jon Lin
    Jan 30, 2014 at 4:25
  • @VarunSheth on my side i already have 'A Record' for www.domai.com with ip pointing to my website ip. but still its not working for me. Nov 19, 2018 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.