wdbo/webdocbook/dev/www/.htaccess - Htaccess File

wdbo/webdocbook/dev/www/.htaccess

########################################################################
# This file is part of the WebDocBook package.
#
# Copyleft (ↄ) 2008-2015 Pierre Cassat <me@e-piwi.fr> and contributors
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# The source code of this package is available online at 
# <http://github.com/wdbo/webdocbook>.
########################################################################

# no indexing
Options -Indexes +FollowSymLinks

# setting the error pages
ErrorDocument 404 /index.php?not_found
ErrorDocument 403 /index.php?forbidden
ErrorDocument 500 /index.php?error

# setting the default WebDocBook markdown handler for each `.md` files
# and the INCLUDES functionality
<IfModule mod_mime.c>
    AddType text/html .md
</IfModule>

# the rewrite URLs rules
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # no access to anything beginning with a dot
    RewriteRule ^(.*/)?.(.*)/ - [F]

    # skip all this for internal assets
    RewriteCond %{REQUEST_URI} ^(.*)webdocbook_assets/(.*)
    RewriteRule "." - [skip=100]

    # skip all this for chapters assets
    RewriteCond %{REQUEST_URI} ^(.*)/assets/(.*)
    RewriteRule "." - [skip=100]

    # special rule for `sitemap.xml` (one per dir)
    RewriteRule ^(.*)sitemap.xml index.php?$1/sitemap [L]

    # if the dir exists, handle it by index.php anyway
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.*)$ index.php?$1 [QSA,L]

    # `index.php` will handle all requests
    RewriteCond $1 !^index.php
    RewriteRule ^(.*)$ index.php?$1 [QSA,L]
</IfModule>

On Github License

Files

Download PDF of Htaccess file
INCLUDES, REQUEST_FILENAME, REQUEST_URI

Comments

Apache