On ruachost.com, you can configure your website to either always include or always remove the www prefix in URLs. This ensures consistency, improves SEO, and prevents duplicate content issues.

 

Why Control the www Prefix?

  • SEO benefits: Search engines may treat www.example.com and example.com as separate sites.

  • Brand consistency: Visitors always see the same format.

  • Avoid duplicate content penalties.

  • Better user experience: Redirects visitors to the preferred version automatically.

 

Adding the www Prefix

To force all visitors to use www.example.com:

  1. Open or create the .htaccess file in your site’s root directory (public_html).

  2. Add the following rewrite rules:

    ## Add www to any URLs that do not have them:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
 
  1. Save the file.

  2. Test by visiting http://example.com — it should redirect to http://www.example.com.

 

Removing the www Prefix

To force all visitors to use example.com without www:

  1. Open or create the .htaccess file in your site’s root directory.

  2. Add the following rewrite rules:

    ## Remove www from any URLs that have them:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.
    RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
    
 
  1. Replace example.com with your actual domain name.

  2. Save the file.

  3. Test by visiting http://www.example.com — it should redirect to http://example.com.

 

Important Notes

  • Use 301 redirects for SEO‑friendly permanent redirection.

  • Only configure one option (add or remove) to avoid redirect loops.

  • If your site uses HTTPS, replace http:// with https:// in the rules.

  • Always back up your .htaccess file before editing.

 
Var dette svaret til hjelp? 0 brukere syntes dette svaret var til hjelp (0 Stemmer)

Powered by WHMCompleteSolution