Answer the question
In order to leave comments, you need to log in
What is the error when redirecting to index.php in .htaccess?
The problem is as follows: there is a local OpenServer server hosting the yii2sitestudy1.loc site. That is, in the domains folder there is yii2sitestudy1.loc, and in this folder there is yii2sitestudy1.loc\frontend\web\index.php. I need that when I enter yii2sitestudy1.loc/ in the address bar of the browser, yii2sitestudy1.loc\frontend\web\index.php opens.
I myself am not familiar with the capabilities of .htaccess and how to do it in it, I found the
following solution on the net: put .htaccess with the following code in the root folder of the yii2sitestudy1.loc site:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URL} ^/.*
RewriteRule ^(.*)$ frontend/web/$1 [L]
RewriteCond %{REQUEST_URL} !^/frontend/web/
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Answer the question
In order to leave comments, you need to log in
Error in specifying the public directory of the web server incorrectly.
/ should initially point to \frontend\web\ in the webserver settings, not via .htaccess.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question