Apache Config Changes


/ Published in: Apache
Save to your folder(s)

1. Removes www using a mod rewrite condition. Put this in your .htaccess file or apache config.
2. Forces https on url.


Copy this code and paste it in your HTML
  1. # 1. force removal of www IN URL
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  4. RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
  5. # END force removal of www IN URL# force www IN URL
  6.  
  7. # 2. start https check
  8. RewriteEngine On
  9. RewriteCond %{SERVER_PORT} 80
  10. RewriteRule ^(.*)$ https://example.com/$1 [R,L]
  11. # end https check

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.