Website- How to redirect non www to www in htaccess
In this tutorials, we are going to share the trick for redirecting a non-www website to www. Most of the time website owner want to redirect their website and a www website look more professional to a non-www.
To do that we need to create a .htaccess
file in your root directory and add the below code.
Please note .htaccess is not a file extension. It’s simply the .htaccess or [dot]htaccess.
.htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Similar Posts
- Maven- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- How to import Spring Boot project in Eclipse/STS IDE
- Deploy jasper reports in JasperReports Server using Parameters
- IntelliJ IDEA- View all exit points of method
- Eclipse/STS shortcut keys for Uppercase and Lowercase