Answer the question
In order to leave comments, you need to log in
Why does a 302 redirect happen?
Hello. Setting up Apache for a Yii2 project. I work locally through OpenServer. If I prescribe root directories in the OpenServer settings, then everything works well.
I remove the settings and try to set up redirects through .htaccess
Yii2 advanced template. First you need to at least configure routing to frontend / web, then to backend / web.
Here are the .htaccess files I got:
Project root:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^/.*
RewriteRule ^(.*)$ /frontend/web/$1 [L]
</IfModule>
# 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
# use index.php as index file
DirectoryIndex index.php
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question