Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
731 B
2
Indexable
Never
RewriteEngine On

# redirect non www to www
RewriteCond %{HTTP_HOST} ^www.localhost [NC]
RewriteRule ^(.*)$ localhost%{REQUEST_URI} [R=301,L]

# redirect index.html to root
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ /$1 [R=301,L]

# redirect index to root
RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index$ /$1 [R=301,L]

# Pozbycie się rozszezen html
RewriteRule ^([a-zA-Z0-9-_]+)$ $1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [L]

# redirect each request filename to index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.html [L]