#AddHandler application/x-httpd-php70 .php

ErrorDocument 403 '<html xmlns="http://www.w3.org/1999/xhtml"><head><style type="text/css" >body{color:#fff;background-color:#851507;font:14px/1.5 Helvetica,Arial,sans-serif};</style><title>Access denied</title></head><body><div style="margin:20px auto;width:700px;padding-top:50px"><h1>Access denied, unauthorized access.<br/><br/>If you think it\'s an error, please inform the webmaster to help him to adjust his security rules.  Thank you.</h1><pre style="padding:20px;white-space:pre-line;border-radius:10px;background-color:#b34334">Code : 403 - Deny access</pre></div></body></html>'
ErrorDocument 404 /marknotes/errors/error_404.html

DirectoryIndex index.php

# Marknotes requires that mod_rewrite is enable
# If it isn't the case on your server please configure it and load
# mod_rewrite
<IfModule mod_rewrite.c>

	RewriteEngine On

	# If the URL rewriting isn't working fine, try to uncomment this
	# line (i.e. remove the "#" before the RewriteBase word)
	#RewriteBase /

	# If still not working fine, try also to uncomment this line.
	# And, if still not working, you'll probably check with your hoster
	# how to enable mod_rewrite on your server.
	# NOTE : uncommenting the Options line below can generate a
	# 500 - Server Error so, if you see that error, comment the line back.
	#Options +FollowSymlinks

	# Special URLs (robots.txt, tags.json, sitemap.xml, ...)

	RewriteCond %{REQUEST_URI} buttons\.json$
	RewriteRule (.*) router.php?task=task.buttons.get [L,QSA]

	RewriteCond %{REQUEST_URI} listfiles\.json$
	RewriteRule (.*) router.php?task=task.listfiles.treeview&$2 [L,QSA]

	RewriteCond %{REQUEST_URI} robots\.txt$
	RewriteRule (.*) router.php?task=task.robotstxt.get [L,QSA]

	RewriteCond %{REQUEST_URI} search\.php$
	RewriteRule (.*) router.php?task=task.search.search [L,QSA]

	RewriteCond %{REQUEST_URI} sitemap\.xml$
	RewriteRule (.*) router.php?task=task.sitemap.get [L,QSA]

	RewriteCond %{REQUEST_URI} tags\.json$
	RewriteRule (.*) router.php?task=task.tags.get [L,QSA]

	RewriteCond %{REQUEST_FILENAME} timeline\.(html|json)
	RewriteRule (.*) router.php?task=task.timeline.get&file=$1 [L,QSA]

	# Access to index.html will be captured and a fake index.html
	# will be generated by task.index.get
	RewriteCond %{REQUEST_URI} .*\/index\.html?$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule (.*) router.php?task=task.index.get&file=$1 [L,QSA]

	# -----------------------------------------------------------------
	# Add rewriting for the different filetypes (doc, epub, html, ...)

	RewriteCond %{REQUEST_URI} .*\.html
	# Exception for ELF
	RewriteCond %{REQUEST_URI} !.*/elf/libs/elf/*
	RewriteRule (.*) router.php?task=task.export.html&file=$1 [L,QSA]

	RewriteCond %{REQUEST_URI} .*\.docx?$
	RewriteRule (.*) router.php?task=task.export.docx&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.epub$
	RewriteRule (.*) router.php?task=task.export.epub&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.md$
	RewriteRule (.*) router.php?task=task.export.md&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.odt$
	RewriteRule (.*) router.php?task=task.export.odt&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.reveal.pdf$
	RewriteRule (.*) router.php?task=task.export.reveal&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.pdf$
	RewriteRule (.*) router.php?task=task.export.pdf&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.remark$
	RewriteRule (.*) router.php?task=task.export.remark&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.reveal$
	RewriteRule (.*) router.php?task=task.export.reveal&file=$1 [L,QSA]
	RewriteCond %{REQUEST_URI} .*\.te?xt$
	RewriteRule (.*) router.php?task=task.export.txt&file=$1 [L,QSA]

	# -----------------------------------------------------------------
	#RewriteCond %{REQUEST_FILENAME} !-f
	#RewriteCond %{REQUEST_FILENAME} !-d
	#RewriteRule (.*) router.php?file=$1&%{QUERY_STRING} [L]

	# Exceptions : don't allow direct access to .md files but
	# reroute to the router.
	# This because .md file content can use plugins calls and
	# these plugins should then first
	# be fired before displaying them on the browser
	#RewriteCond %{REQUEST_FILENAME} -f
	#RewriteCond %{REQUEST_URI} \.(md)$
	#RewriteRule (.*) router.php?file=$1&%{QUERY_STRING} [L]

	# Block access to hidden files / folders but allow .files, .images or .well)-known
	RewriteCond %{SCRIPT_FILENAME} -d [OR]
	RewriteCond %{SCRIPT_FILENAME} -f
	RewriteRule "(^|/)\.(?!(files|images|well-known))" - [R=403,NC,L]

	# Block access to somes files
	RewriteCond %{REQUEST_FILENAME} (composer.json|composer.lock|htaccess.txt|package.json|post-install.bat|settings.json|settings.json.dist|tags.json)$
	RewriteCond %{SCRIPT_FILENAME} -f
	RewriteRule .* - [R=403,NC,L]

	# Only deploy.php, index.php or router.php are allowed;
	# whatever the script location
	RewriteCond %{REQUEST_FILENAME} !(debug|deploy|index|install|router)\.php

	# And allow an exception for ELF
	RewriteCond %{REQUEST_URI} !.*/task/elf/libs/*
	RewriteCond %{REQUEST_FILENAME} \.(php)$
	RewriteRule .* - [R=403,NC,L]

</IfModule>
