Skip to content

Instantly share code, notes, and snippets.

@obojdi
Created February 4, 2015 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obojdi/4aa9229f2c18f8552117 to your computer and use it in GitHub Desktop.
Save obojdi/4aa9229f2c18f8552117 to your computer and use it in GitHub Desktop.
apache standard conf
DirectoryIndex index.php
ErrorDocument 404 /404/
RewriteEngine On
Options +FollowSymlinks
Options -Indexes -MultiViews
################################################################
#
# СТАНДАРТНЫЕ ПРЕОБРАЗОВАНИЯ
#
################################################################
# Два слэша в один
RewriteCond %{THE_REQUEST} /[/]
RewriteRule ^.*$ http://%{HTTP_HOST}/? [R=301,L]
# Убраем index из урла
RewriteCond %{REQUEST_URI} ^/index\.(.+)$
RewriteRule ^.*$ http://%{HTTP_HOST}/? [R=301,L]
# если обращение к директории без слеш на конце урла - добавляем /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) /$1/ [R=301,L]
#закрываем запуск .inc файлов
RewriteCond %{REQUEST_URI} \.inc
RewriteRule ^.*$ http://%{HTTP_HOST}/? [R=404,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment