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
- How to import Gradle project in Eclipse/STS
- Eclipse/STS shortcut keys for Uppercase and Lowercase
- WAMP/XAMPP Server- .htaccess redirect rule not working on localhost
- IntelliJ IDEA– Remove/Optimize unused imports shortcut keys
- IntelliJ IDEA – Spring Boot Dev Tools is not working
- How to customize command prompt in Windows 7?
- How to install Activiti Designer plugin in Eclipse/STS
- IntelliJ IDEA – Find file containing text shortcut
- Maven- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- How to view recently opened files in IntelliJ IDEA