W
W
whiteleaf2015-02-24 02:50:39
Yii
whiteleaf, 2015-02-24 02:50:39

(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

But here the web disappears only when you go directly to the site, and when you click on the links, it reappears.
How can I competently make such things as: web, frontend & backend not glow in the url?
Thank you all in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrew Vakulenko, 2015-02-24
@whiteleaf

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

W
windoctor, 2015-02-24
@windoctor

You have such problems because you have not configured the server correctly. The directory where Apache should look is web, not root.

S
ShamblerR, 2015-02-24
@ShamblerR

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 question

Ask a Question

731 491 924 answers to any question