Folder configuration
If you are using another folder inside server root as the root folder for core, you need to change RewriteBase and RewriteRule values in the .htaccess file. For example if you are using /folder/anotherfolder/ inside your web server root you need to change it to this:
RewriteBase /folder/anotherfolder/
If you are using core inside server root:
You can leave it as comment (not using it) and it may work without any problem, but giving the proper value is recommended.
Folder Indexing
By default we disabled folder indexing:
If you want to enable folder indexing, change it to the:
We strongly recommend to disable folder indexing when your website is live.
Cache
By default we created 15 days cache, You can change the values or remove these lines:
# Cache
<IfModule mod_expires.c>
ExpiresActive On
# 15 days
ExpiresDefault A1296000
</IfModule>
301 Forward https
You can use these lines to forward all http URLs to the https:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
301 Forward www
When website visitors visit your website with www.example.com, you can forward them to example.com. and vice versa. You should pick one. Domain with www or without.
By default we commented 301 forward. We recommend to use it when your website is live. To forward all www to non-www:
RewriteRule ^ - [E=ssls]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=ssls:s]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http%{ENV:ssls}://%1/$1 [R=301,L]
If you are in proxy server:
RewriteRule ^ - [E=ssls]
RewriteCond %{HTTP:X-Forwarded-Proto} https [OR]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=ssls:s]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http%{ENV:ssls}://%1/$1 [R=301,L]
Protecting .php files from loading directly
For security reason, .php files can not load directly. If you have a library that needs to load php files directly, you should create another .htaccess file in that library folder like this:
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
Make sure your library files don't show any error or unexpected result when they are loading directly.