-
Notifications
You must be signed in to change notification settings - Fork 0
Better redirection rules for apache #4
Copy link
Copy link
Open
Description
Because the .htaccess rules on the frontpage doesn't always work, I've created my own rules. The .htaccess file should be put into the public folder and works on every path. So it doesn't has to be top domain. (I'm also trying to get a proper nginx configuration, but aren't there yet)
RewriteEngine On
# Split the request uri into path till this directory and path after it
RewriteRule ^(.*)$ - [NC,E=ARG:$1]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
# Now handle the static pages
RewriteCond %{DOCUMENT_ROOT}%{ENV:BASE}_static/index.html -f
RewriteRule ^index.php$ _static/index.html
RewriteCond %{DOCUMENT_ROOT}%{ENV:BASE}_static/%{ENV:ARG} -f
RewriteCond %{REQUEST_FILENAME} !_static/
RewriteRule ^(.*)$ _static/%{ENV:ARG}
RewriteCond %{DOCUMENT_ROOT}%{ENV:BASE}_static/%{ENV:ARG}/index.html -f
RewriteCond %{REQUEST_FILENAME} !_static/
RewriteRule ^(.*)$ _static/%{ENV:ARG}
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !_static/
RewriteRule ^ index.php [END]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels