weepower/wee-website/master/public_html/.htaccess - Htaccess File

weepower/wee-website/master/public_html/.htaccess

#------------------------------------
  # Setup
#------------------------------------

RewriteEngine On
Options +FollowSymLinks -Indexes -MultiViews

# Internet Explorer document mode
Header set X-UA-Compatible "IE=edge"

# Disable iframe embedding
Header always append X-Frame-Options SAMEORIGIN

# Character set
AddDefaultCharset utf-8
AddCharset utf-8 .atom .css .geojson .js .json .jsonld .manifest .map .rss .xml

# HTTP Strict Transport Security
Header always set Strict-Transport-Security "max-age=7776000; includeSubDomains"

#------------------------------------
  # Remote Assets
#------------------------------------

# Cross-origin images
<FilesMatch ".(bmp|gif|ico|jpe?g|png|svg|webp)$">
  SetEnvIf Origin ":" IS_CORS
  Header set Access-Control-Allow-Origin "*" env=IS_CORS
</FilesMatch>

 # Cross-origin web fonts
<FilesMatch ".(eot|otf|ttf|woff2?)$">
  Header set Access-Control-Allow-Origin "*"
</FilesMatch>

#------------------------------------
  # Errors
#------------------------------------

ErrorDocument 404 /404.html

#------------------------------------
  # Project
#------------------------------------

Redirect 301 /build/validation /build/commands

#------------------------------------
  # Rewrites
#------------------------------------

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

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

# Remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]

# Remove multiple slashes
RewriteCond %{THE_REQUEST} //
RewriteRule ^(.*)$ /$1 [R=301,L]

# Remove index reference
RewriteCond %{REQUEST_URI} ^(.*/)index.html$ [NC]
RewriteRule . %1 [R=301,L]

# Remove extension
RewriteCond %{REQUEST_URI} ^GET (.*).html(.*) HTTP
RewriteRule (.*).html$ $1$2 [R=301]

# Rewrite extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule (.*) $1.html [L]

On Github License

Files

Download PDF of Htaccess file
GET, HTTP_HOST, HTTPS, ORIGIN, REQUEST_FILENAME, REQUEST_URI, THE_REQUEST

Comments

Apache