46 lines
1.4 KiB
ApacheConf
46 lines
1.4 KiB
ApacheConf
# Use the front controller as index file
|
|
DirectoryIndex index.php
|
|
|
|
# Disabling MultiViews prevents unwanted negotiation
|
|
<IfModule mod_negotiation.c>
|
|
Options -MultiViews
|
|
</IfModule>
|
|
|
|
<IfModule mod_rewrite.c>
|
|
RewriteEngine On
|
|
|
|
# Determine the RewriteBase automatically and set it as environment variable
|
|
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
|
|
RewriteRule .* - [E=BASE:%1]
|
|
|
|
# Sets the HTTP_AUTHORIZATION header removed by Apache
|
|
RewriteCond %{HTTP:Authorization} .+
|
|
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
|
|
|
|
# Redirect to URI without front controller to prevent duplicate content
|
|
RewriteCond %{ENV:REDIRECT_STATUS} =""
|
|
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=308,L]
|
|
|
|
# Handle UI routes - let Symfony handle /ui/* routes
|
|
RewriteCond %{REQUEST_URI} ^/ui
|
|
RewriteRule ^ %{ENV:BASE}/index.php [L]
|
|
|
|
# Handle Auth routes - let Symfony handle /auth/* routes
|
|
RewriteCond %{REQUEST_URI} ^/auth
|
|
RewriteRule ^ %{ENV:BASE}/index.php [L]
|
|
|
|
# Handle API routes - let Symfony handle /api/* routes
|
|
RewriteCond %{REQUEST_URI} ^/api
|
|
RewriteRule ^ %{ENV:BASE}/index.php [L]
|
|
|
|
# If the requested filename exists, simply serve it
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteRule ^ %{ENV:BASE}/index.php [L]
|
|
</IfModule>
|
|
|
|
<IfModule !mod_rewrite.c>
|
|
<IfModule mod_alias.c>
|
|
RedirectMatch 307 ^/$ /index.php/
|
|
</IfModule>
|
|
</IfModule>
|