20 lines
563 B
ApacheConf
20 lines
563 B
ApacheConf
RewriteEngine On
|
|
|
|
# /about/ → /about (real folders such as /img/ and /css/ stay as they are)
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule ^(.+)/$ /$1 [R=301,L]
|
|
|
|
# /index.html → /
|
|
RewriteCond %{THE_REQUEST} \s/+index\.html[\s?] [NC]
|
|
RewriteRule ^index\.html$ / [R=301,L,QSA]
|
|
|
|
# /about.html → /about
|
|
RewriteCond %{THE_REQUEST} \s/+(.+?)\.html[\s?] [NC]
|
|
RewriteRule ^ /%1 [R=301,L,QSA]
|
|
|
|
# /about → about.html
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME}.html -f
|
|
RewriteRule ^(.+?)/?$ $1.html [L]
|