shalvasoft/MVC/master/.htaccess
RewriteEngine on
# Set REQUEST_SCHEME (standard environment variable in Apache 2.4)
RewriteCond %{HTTPS} off
RewriteRule .* - [E=REQUEST_SCHEME:http]
RewriteCond %{HTTPS} on
RewriteRule .* - [E=REQUEST_SCHEME:https]
# Follow symbolic links.
Options +FollowSymLinks
# Check for POST Submission
RewriteCond %{REQUEST_METHOD} !^POST$
# Redirect to domain with www.
RewriteCond %{HTTPS} off
RewriteCond %{SERVER_PORT} 80
RewriteCond %{SERVER_NAME} !^www. [NC]
RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# Redirect to domain with www.
RewriteCond %{HTTPS} on
RewriteCond %{SERVER_PORT} 443
RewriteCond %{SERVER_NAME} !^www. [NC]
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# Rewrite for links
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
# Prevent viewing of htaccess file.
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
On Github License
Files
Download PDF of Htaccess file