January 31, 2016

htaccess if site open with www and its redirect without www


- If you want to open your site with out www then just simple write 2 lines in you .htaccess file and upload it in your root server.

For example:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.domainname.com [NC]

RewriteRule ^(.*)$ http://domainname.com/$1 [L,R=301]

Note: In above example replace your currect domainname. If you have SSL certificate then used https:// instead of http://.


- And if you want used force www on without www domain name,

- Then just below 2 lines in your .htaccess file and upload in your root server.

For example:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^domainname.com [NC]

RewriteRule ^(.*)$ http://www.domainname.com/$1 [L,R=301,NC]

Note: In above example replace your currect domainname. If you have SSL certificate then used https:// instead of http://.

If you have any question related any .htaccess rules issue then please comment me here I will you to solved that.

Enjoy!

1 comment:

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...