Answer the question
In order to leave comments, you need to log in
(Yii2) How to remove web from url?
Tell me, please, how can I make it so that I can avoid the address like example/web/site/index, but it was like this, example/site/index.
I have already tried to play differently with the .htaccess file.
I got close to the result using the following settings:
DirectoryIndex /web/index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . web/index.php
Answer the question
In order to leave comments, you need to log in
here is one of the solutions https://github.com/ilopX/yii2-basic-htaccess
the only thing to pay attention to is the Options +FollowSymlinks directive
, some hosters may swear - 500 error
in this case can be replaced with Options +SymLinksIfOwnerMatch
You have such problems because you have not configured the server correctly. The directory where Apache should look is web, not root.
Apache configs in the studio.
if you have nginx + apache, you may have a problem here. But to be honest, I can’t imagine what could be done with the server. I think you have a hardcoded code somewhere.
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question