Raphhh/php-app-bootstrap/master/public/.htaccess - Htaccess File

Raphhh/php-app-bootstrap/master/public/.htaccess

# http://httpd.apache.org/docs
# http://httpd.apache.org/docs/current/en/configuring.html
# http://httpd.apache.org/docs/1.3/howto/htaccess.html

RewriteEngine on

# redirect www subdomain to the non-www subdomain (ex: http://www.website.com => http://website.com)
Rewritecond %{HTTP_HOST} ^www.(.*)$
Rewriterule ^(.*) http://%1/$1 [QSA,L,R=301]

# clean up URLs to remove file extensions
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html

# redirect to index.php all the URLs pointing to a not exiting file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php [L]

# restrict .htaccess access
<Files .htaccess>
  order allow,deny
  deny from all
</Files>

# URL Error handling
#ErrorDocument 400 /error/bad-request
#ErrorDocument 401 /error/unauthorized
#ErrorDocument 403 /error/forbidden
#ErrorDocument 404 /error/not-found
#ErrorDocument 500 /error/internal-server-error

On Github License

Files

Download PDF of Htaccess file
HTTP_HOST, REQUEST_FILENAME

Comments

Apache