In this article, we will explain to you how to remove www from your URL using htaccess. so we will give you a simple example of how to remove www from your URL using htaccess.
If you have a purchase SSL certificate and you want to remove www from domain using htaccess. it is possible to the .htaccess. first, create a .htaccess file in your root project directory and paste the following code.
Note: the Apache mod_rewrite module must be enabled. Otherwise, the following snippet will not work.
1 2 3 | RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] |