arnehendriksen/front-end-boilerplate/master/public_html/.htaccess - Htaccess File

arnehendriksen/front-end-boilerplate/master/public_html/.htaccess

## Follow symbolic links
Options +FollowSymLinks

## Deny access to directory listing
Options -Indexes

<IfModule mod_rewrite.c>

  ## Rewrite defaults
  RewriteEngine On
  RewriteBase /

  # Redirect http to https
  #RewriteCond %{HTTPS} off
  #RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  ## Force non-www
    RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    ## Force www
    #RewriteCond %{HTTP_HOST} !^www.
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

  ## Remove trailing slashes
  RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1

</IfModule>

## 404 redirect
ErrorDocument 404 /errors/404.html

On Github License

Files

Download PDF of Htaccess file
HTTP_HOST, HTTPS, REQUEST_URI

Comments

Apache