stefanbc/Asgar/master/.htaccess - Htaccess File


RewriteEngine On
    <IfModule mod_expires.c>
    # Enable expirations
    ExpiresActive On
    # Default directive
    ExpiresDefault "access plus 1 month"
    # My favicon
    ExpiresByType image/x-icon "access plus 1 year”
    # Images
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    # CSS
    ExpiresByType text/css "access 1 month”
    # Javascript
    ExpiresByType application/javascript "access plus 1 year"

    <IfModule mod_headers.c>
      <FilesMatch ".(js|css|xml|gz)$">
        Header append Vary: Accept-Encoding

    # Redirect if file with php extension is called
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^([^/]+)$ $1.php

    # Rewrite page url with page title
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z0-9_]+)$ index.php?page=$1 [L,QSA]

    # Rewrite page url with post title
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (?:.*?)/([^/]*)$ index.php?post=$1 [L,QSA]

On Github License


Download PDF of Htaccess file