Skip to content
Snippets Groups Projects
Commit ab6a9d1a authored by Christoph Groth's avatar Christoph Groth
Browse files

add .htaccess for URL rewriting

parent 4360b5f7
No related branches found
No related tags found
No related merge requests found
RewriteEngine on
# We don't need more than that.
RewriteOptions MaxRedirects=2
# Redirect /foo/index.html to /foo/
RewriteRule ^(|.*/)index\.html$ /$1 [R=301,L]
# Redirect /foo/bar.html to /foo/bar only if a html file was requested by the
# browser. Without the condition the following rewrite rule leads to a
# redirection loop.
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
# Rewrite /foo/bar to /foo/bar.html if the latter exists.
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*[^/])$ /$1.html [L]
# Remove trailing slash if the requested directory does not exist.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment