From d241a93ce332e1a725f9a2b812d4d262cc4e5843 Mon Sep 17 00:00:00 2001 From: ulearnpro Date: Mon, 2 Sep 2019 12:09:33 +0530 Subject: [PATCH] htaccess added --- .htaccess | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..69a82543 --- /dev/null +++ b/.htaccess @@ -0,0 +1,49 @@ +RewriteEngine On +RewriteCond %{HTTP_HOST} !^www\. [NC] +RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] + +#Enable if https needed +#RewriteCond %{HTTPS} !=on +#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] + +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)/$ /$1 [L,R=301] + +RewriteCond %{REQUEST_URI} !(\.css|\.otf|\.eot|\.ttf|\.woff|\.woff2|\.js|\.png|\.jpeg|\.jpg|\.gif|robots\.txt)$ [NC] +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^ index.php [L] + +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-f +#RewriteCond %{REQUEST_URI} !^/public/ +RewriteRule ^(frontend|backend|css|js|vendor|storage)/(.*)$ public/$1/$2 [L,NC] + +# Handle Authorization Header +RewriteCond %{HTTP:Authorization} . +RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + + + ExpiresActive On + + # Images + ExpiresByType image/jpeg "access plus 1 year" + ExpiresByType image/gif "access plus 1 year" + ExpiresByType image/png "access plus 1 year" + ExpiresByType image/webp "access plus 1 year" + ExpiresByType image/svg+xml "access plus 1 year" + ExpiresByType image/x-icon "access plus 1 year" + + # Video + ExpiresByType video/mp4 "access plus 1 year" + ExpiresByType video/mpeg "access plus 1 year" + + # CSS, JavaScript + ExpiresByType text/css "access plus 1 month" + ExpiresByType text/javascript "access plus 1 month" + ExpiresByType application/javascript "access plus 1 month" + + # Others + ExpiresByType application/pdf "access plus 1 month" + ExpiresByType application/x-shockwave-flash "access plus 1 month" +