Commit 61f6789b0c4b57d58a940c9b230b5909869943d7
1 parent
25de22ee
htaccess
Showing
1 changed file
with
24 additions
and
88 deletions
Show diff stats
.htaccess
| 1 | +Options FollowSymLinks | |
| 1 | 2 | AddDefaultCharset utf-8 |
| 2 | -<IfModule mod_rewrite.c> | |
| 3 | - | |
| 4 | - | |
| 5 | - Options +FollowSymlinks | |
| 6 | - | |
| 7 | - RewriteEngine On | |
| 8 | - | |
| 9 | -</IfModule> | |
| 10 | 3 | |
| 11 | 4 | <IfModule mod_rewrite.c> |
| 5 | + RewriteEngine On | |
| 12 | 6 | |
| 13 | - RewriteBase / | |
| 14 | - # deal with admin first | |
| 15 | - | |
| 16 | - | |
| 17 | - | |
| 18 | - RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] | |
| 19 | - | |
| 20 | - RewriteCond %{REQUEST_URI} ^/(admin) | |
| 21 | - | |
| 22 | - | |
| 23 | - | |
| 24 | - RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] | |
| 25 | - | |
| 26 | - RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] | |
| 27 | - | |
| 28 | - RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L] | |
| 29 | - | |
| 30 | - RewriteRule ^admin/images/(.*)$ backend/web/images/$1 [L] | |
| 31 | - | |
| 32 | - RewriteRule ^admin/fonts/(.*)$ backend/web/fonts/$1 [L] | |
| 33 | - | |
| 34 | - | |
| 35 | - | |
| 36 | - | |
| 37 | - | |
| 38 | - RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js|images|fonts)/ | |
| 39 | - | |
| 40 | - RewriteCond %{REQUEST_URI} ^/(admin) | |
| 41 | - | |
| 42 | - RewriteRule ^.*$ backend/web/index.php [L] | |
| 43 | - | |
| 44 | - | |
| 45 | - RewriteCond %{REQUEST_URI} ^/(assets|css) | |
| 46 | - | |
| 47 | - RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L] | |
| 48 | - | |
| 49 | - RewriteRule ^css/(.*)$ frontend/web/css/$1 [L] | |
| 50 | - | |
| 51 | - RewriteRule ^js/(.*)$ frontend/web/js/$1 [L] | |
| 52 | - | |
| 53 | - RewriteRule ^images/(.*)$ frontend/web/images/$1 [L] | |
| 54 | - | |
| 55 | - RewriteRule ^libraries/(.*)$ frontend/web/libraries/$1 [L] | |
| 56 | - | |
| 57 | - RewriteRule ^img/(.*)$ frontend/web/img/$1 [L] | |
| 58 | - | |
| 59 | - RewriteRule ^files/(.*)$ frontend/web/files/$1 [L] | |
| 60 | - | |
| 61 | - RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L] | |
| 62 | - | |
| 63 | - RewriteRule ^contacts/(.*)$ frontend/web/contacts/$1 [L] | |
| 64 | - | |
| 65 | - RewriteRule robots.txt$ frontend/web/robots.txt [L] | |
| 66 | - | |
| 67 | - RewriteRule feed\.csv$ frontend/web/feed.csv [L] | |
| 68 | - | |
| 69 | - RewriteRule sitemap(\d*)\.xml$ frontend/web/sitemap$1.xml [L] | |
| 70 | - | |
| 71 | - RewriteRule hotline\.xml$ frontend/web/hotline.xml [L] | |
| 72 | - | |
| 73 | - RewriteRule yaml\.xml$ frontend/web/yaml.xml [L] | |
| 74 | - | |
| 75 | - RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|txt|js|images|fonts|img|files|contacts)/ | |
| 76 | - | |
| 77 | - RewriteCond %{REQUEST_URI} !index.php | |
| 7 | + # the main rewrite rule for the frontend application | |
| 8 | + RewriteCond %{REQUEST_URI} !^/(backend/web|admin) | |
| 9 | + RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L] | |
| 78 | 10 | |
| 79 | - RewriteCond %{REQUEST_FILENAME} !-f [OR] | |
| 11 | + # redirect to the page without a trailing slash (uncomment if necessary) | |
| 12 | + #RewriteCond %{REQUEST_URI} ^/admin/$ | |
| 13 | + #RewriteRule ^(admin)/ /$1 [L,R=301] | |
| 14 | + # the main rewrite rule for the backend application | |
| 15 | + RewriteCond %{REQUEST_URI} ^/admin | |
| 16 | + RewriteRule ^admin(.*) /backend/web/$1 [L] | |
| 80 | 17 | |
| 18 | + # if a directory or a file of the frontend application exists, use the request directly | |
| 19 | + RewriteCond %{REQUEST_URI} ^/frontend/web | |
| 20 | + RewriteCond %{REQUEST_FILENAME} !-f | |
| 81 | 21 | RewriteCond %{REQUEST_FILENAME} !-d |
| 22 | + # otherwise forward the request to index.php | |
| 23 | + RewriteRule . /frontend/web/index.php [L] | |
| 82 | 24 | |
| 83 | - RewriteCond %{HTTP_HOST} ^www\.(.*) | |
| 84 | - RewriteRule ^(.*)$ frontend/web/index.php | |
| 85 | - | |
| 86 | - | |
| 87 | - RewriteCond %{HTTP_HOST} ^([^www].*)$ | |
| 88 | - RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
| 89 | - | |
| 90 | - RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] | |
| 91 | - RewriteRule /$ /%1 [R,L] | |
| 92 | - | |
| 93 | - | |
| 94 | - | |
| 95 | - RewriteCond %{HTTP_HOST} ^([^www].*)$ | |
| 96 | - RewriteRule ^(.*)$ http://www.%1/$1 [R=301] | |
| 25 | + # if a directory or a file of the backend application exists, use the request directly | |
| 26 | + RewriteCond %{REQUEST_URI} ^/backend/web | |
| 27 | + RewriteCond %{REQUEST_FILENAME} !-f | |
| 28 | + RewriteCond %{REQUEST_FILENAME} !-d | |
| 29 | + # otherwise forward the request to index.php | |
| 30 | + RewriteRule . /backend/web/index.php [L] | |
| 97 | 31 | |
| 32 | + RewriteCond %{REQUEST_URI} \.(htaccess|htpasswd|svn|git) | |
| 33 | + RewriteRule \.(htaccess|htpasswd|svn|git) - [F] | |
| 98 | 34 | </IfModule> |
| 99 | 35 | |
| 100 | 36 | #для возможности загрузки файлов парсера | ... | ... |