How to Fix Unable to access Website with “www” For WordPress Websites

Hosting a website is not exactly an easy task. There are several aspects and factors that you need to take care of when you host a website. One of the issues you may face is that your site may or may not work and go inaccessible when you or your visitors try visiting your site. We found one of the issues that your visitors may complain about is they are not able to access your site with www. How would we able to sort out the problem? Let us check out the options in this post.

What causes the issue Unable to access Website with WWW?

There can be several causes that can cause this issue. One of the most common reasons that can bring up this issue can be the fact that your website may not have a proper or correct corresponding CNAME. Another aspect can be the site’s DNS settings may have a wrong CNAME record.

However, it may not be easy to pinpoint the exact reason for the issue. While the DNS may be the primary culprit, there can be a few other reasons as well. However, analyzing the exact causes need to be on a case to case basis.

How to Fix Update to access the website with WWW?

Now that we have assumed that the DNS settings are the culprit for the issue, it may be a good idea to narrow down your troubleshooting to this particular arena. The easiest option to sort out the problem should be to go to your DNS setting s and add a CNAME for your site. This should solve your problem by every standard.

One of the other solutions can be to use the Hosts file to check if it is the DNS issue. Launch the Hosts file and add both the names with or without to the “Hosts file.” Ping them to check what results do you get. If it works fine, you can navigate to the browser and check if it works fine.

A few other options will include the following options –

Use www subdomain

Most of the website hosting services offer you the selections to use the www subdomain or not use it. However, a wiser approach should be to use an option to leave it off altogether. This option will accept the site with both www and without it.

Here are the steps involved in sorting out the issue –

  • Visit the page for managing your domains. This will be dependent upon the website hosting service you have opted for.
  • Find the option for editing the domain settings.
  • You should find the option for managing your domain.

You would get three options here –

  • Leave it Alone – both the versions with or without www will work
  • Add WWW – site without www will redirect to the one with www
  • Remove WWW – site with www will redirect to the one without www.

Save these settings, and you are good to go. The exact descriptions may differ from one hosting service to another. However, the functionality should remain almost similar.

Using the .htaccess file to address the issue

One of the alternative options is to use the .htaccess file and edit to introduce the functionality of using www while accessing your website. The CPanel is one of the best choices you can use for the purpose, but if you are not comfortable or do not want to use the option for solving the issue – you can use the opportunity for editing .htaccess file.

If you want to remove the www from the site or the site requests, use the following code to your .htaccess file.

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]

RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

This is called adding the mod_rewrite rule to your .htaccess file.

You can also force www subdomain inside the .htaccess file. Follow the same example as above to include the following code to your .htaccess file. This is referred to as removing the link to mod_rewrite.

Add the following code to your .htaccess file.

RewriteEngine On

RewriteCond %{HTTP_HOST}  !^www.example.com$ [NC]

RewriteRule ^(.*) http://www.example.com/$1 [L,R]

Whenever someone uses the address without www, this code redirects them to the site with www.

Please note that removing www can have severe issues with WordPress. WordPress expects the URL to either have it force www or remove www without any conflicts. In case the database is forcing www, and your cPanel does force for its removal, you may face the redirect loop issues.

Make sure that there is no such conflict between the hosting panel and your WordPress configuration.

Several reasons may affect your functionality. Under standard conditions, the solutions we have outlined above should sort out most of the issues you may come across. Ideally, the web hosting services and DNS settings within the service handle this effectively. In case of any problems, you may find the resolutions outlined above should sort out the issue in most cases.

The Concluding Thoughts

That was all we have for the issues you may be having concerning the inability to access your site with www. Under ideal circumstances, you should be able to address it with the help of cPanel or your domain hosting services.  The primary culprit that can affect you for the said error is the DNS settings and treating it should not be much difficult. Consulting your hosting service provider – in case you are not proficient enough can help you address the issue.

Have you come across the issue concerning your site? What are the fixes you applied and which among them worked for you? Share your thoughts, inputs, and experiences with us. This can go a long way in promoting the horizon of our knowledge concerning the issues.

spot_img

More from this stream

Recomended