# /path/to/application/apache.conf
# UTF-8 forever!
# ==============================
AddDefaultCharset utf-8
# Main URL rewriting rules
# ==============================
RewriteEngine On
# If $showScriptName is false in UrlManager, do not allow accessing URLs with script name
RewriteRule ^(/backend)?/index.php/ - [L,R=404]
# Protect against access to special files
RewriteRule \.(htaccess|htpasswd|svn|git) - [L,R=404]
# Frontend
# ==============================
DocumentRoot /path/to/application/frontend/web
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
# Use mod_rewrite for pretty URL support
RewriteEngine On
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# Backend
# ==============================
Alias /backend /path/to/application/backend/web
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
# Use mod_rewrite for pretty URL support
RewriteEngine On
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php