Skip to content
Hostripples Web Hosting
  • Blog Home
  • Shared
    • SSD Shared Hosting
    • Linux Shared Hosting
    • Windows Shared Hosting
    • WordPress Hosting
    • Business Hosting
    • JSP/Tomcat Hosting
  • Reseller
    • SSD Linux Reseller
    • Linux Reseller
    • Windows Reseller
    • WHMCS SSD reseller
  • Dedicated
    • Gaming Dedicated Server
    • Canada Dedicated Server
    • USA Dedicated Server
    • Indian Dedicated Server
    • More Dedicated Server
  • VPS
    • XEN VPS Server
    • Open VZ VPS Server
    • SSD VPS
    • Plesk VPS
  • Email Hosting
    • Business Email
    • Spam Experts
  • Add-Ons
    • SSL Certificate
    • Site Lock
    • Site Lock VPN
    • Codeguard Backup
    • Website Builder
  • Hot Offers
    • Domain Offers
    • Hosting Offers
  • Domains
    • Register Domain
    • Transfer Domain
How to force www or non-www in your .htaccess file in cPanel, Hostripples Web Hosting
Posted on July 11, 2015December 29, 2016 by Vishwajit Kale

How to force www or non-www in your .htaccess file in cPanel

Table of Contents

  • Force www or non-www in your .htaccess file in cPanel

How to force www or non-www in your .htaccess file in cPanel

Many customers at some point request to force either the www or non-www version of their site to display in their visitor’s browser. Though this results in the same site being displayed there is some thought that using only one version is better for search engine optimization. This article will guide you through how to force your site to use either version by making a change in the .htaccess file.

Force www or non-www in your .htaccess file in cPanel

Step 1:  Log into your cPanel.

Step 2: Find the Files category and click on the File Manager icon.
  

www, How to force www or non-www in your .htaccess file in cPanel, Hostripples Web Hosting

 

 

Step 3 : A popup box will appear. For the primary domain, click on the Web Root radio button. For addon domains, click on the dropdown and find your desired addon domain name. Be sure the checkbox next to Show Hidden Files is checked.

Step 4 : Click the Go button to enter the File Manager.

Step 5 : You should now be in the root folder of the domain you chose. Look for the .htaccess file and right click on it. This brings up a menu.

Step 6 : Find and click on the Edit option. If you get a popup box, simply find and click the Edit button in the lower right corner to continue to the editor.

 Step 7 : You are now in the text editor. Place either selection of code in the file and click on the Save Changes button at the top right corner of the screen. Be sure to replace ‘example.com‘ with your actual domain name.

NOTE: Do not place both selections of code in the file as it will cause an error.

    #Force www:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]

    #Force non-www:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
    RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

 Step 8 : Once you insert the code, click on the Save Changes button in the upper right corner to save the code change. You can now type your domain name either with or without the www and it will display in the address bar in the format you have set the code for.

 


How to force www or non-www in your .htaccess file in cPanel, Hostripples Web Hosting

Vishwajit Kale

Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.
View all posts

Share this:

  • Tweet
  • WhatsApp
  • More
  • Pocket
  • Share on Tumblr
  • Print
  • How to force www or non-www in your .htaccess file in cPanel, Hostripples Web Hosting

Like this:

Like Loading...

Related

cPanel.htaccess cpanel error file File Manager Force www htaccess file Log in cPanel non-www root Save Changes www

Post navigation

Get Your Website Online using RVsitebuilder In $12/year – Hostripples
How to Install WXAMPP in Windows?

Recent Posts

  • How to Give cPanel Access to Support for Accessing Your Server: cPanel Support
  • The Ultimate Guide for Cloudflare cPanel Plugin Installation on Server
  • What is Leech Protection in cPanel? Steps to configure leech protection
  • Steps to create, edit, and remove scheduled task in Plesk- Hostripples
  • cPanel Security Advisory | Code execution due to faulty file extension dispatching.
Unlimited-web-hosting

Domain Name Starting from $ 1.99

Archives

Secured Wordpress Hosting

Categories

Linux Reseller Hosting

You must log in to post a comment.

Company

  • About Us
  • Data Centers
  • Client Reviews
  • Contact Us
  • Our Client
  • Coupon Partners
  • Sell Your Business

Resources

  • Blog
  • Affiliate Programs
  • Affiliate Banners
  • Web Design & Development
  • Legal
  • Support Center
  • Open Ticket
  • Knowledge base

Popular Application

  • Joomla Hosting
  • WordPress Hosting
  • Magento Hosting
  • Drupal Hosting
  • Django Hosting
  • OS Commerce Hosting
  • Video Hosting
  • More Applications

Features

  • Free Site Builder
  • Free PHP scripts
  • WHM/cPanel Features
  • Free Domain Reseller
  • Plesk Features

WHO WE ARE

Hostripples is one of the top Cheapest Web Hosting Company in USA, Canada, France, UK and Europe. We Provide Linux cPanel Hosting, Windows Plesk Hosting, Reseller Hosting, OpenVz VPS, XEN VPS, Cloud VPS and Dedicated Server in Affordable Cost.

There are many Hosting company in USA, Canada, France, UK and Europe, But the question you need to ask is - "Do they provide any value added services?" or "Are they available 24 hours a day, 7 days a week & 365 days a year.". Try "Hostripples", the No.1 Web Hosting Company in USA, Canada, France, UK and Europe. Host your websites with the best in Industry & Leave burden of hosting to the most reliable & best support team in the Hosting Industry. NO Hidden Charges, NO Extra Fee and NO set up charges, This is our policy and promise to our customers. We have become a trusted name in the web hosting industry with 50000+ clients all over World. Our cutting edge technology in web hosting, Makes us pioneers in providing uninterrupted service to all our customers.

Benefits of Choosing Hostripples

  • Guaranteed 99.9% uptime.
  • Our Linux Hosting plans come with Latest PHP and MySQL Databases.
  • Our best web hosting plans support CMS like Wordpress, Joomla, Drupal, Magento and more.
  • Each of our web hosting plans contains email, FTP, and sub-domains We also provide 24/7 Technical support.
  • Custom hosting plans according to the clients requirements.
  • No Hidden Cost, NO Setup fee & No Extra Payments
  • FREE Control Panel, Database Manager, Add-on/Parked Domain.
  • 24/7 Support in multiple local languages.
  • Free installation and setup of Blog/Business/E-commerce Websites.
  • FREE RVSiteBuilder/Web Email/Email Forwarding.
  • Phone Support & Email/Ticket Support & Chat Support.
  • POP3/SMTP/IMAP/PHP/Python/MySql Support.
  • In Build DDOS Protection.
  • Tier-4 Data-center with cutting edge technology.

© 2013-2021.. All Rights Reserved.Hostripples a division of SARPS Technolog!es LLC Delaware, USA.

Sign Up Now and get flat 50% off on all shared and reseller hosting

×
%d bloggers like this: