Yii 2.0 hiding /basic/web from the URL along with the index.php

前端 未结 3 753
轮回少年
轮回少年 2021-01-06 17:09

Plenty of information around the net on how to hide the index.php from your Yii 2.0 application URL, however, what I\'m trying to do here is to also remove the \'/basic/web/

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-06 17:43

    The Working Solution is Here!

    Step 1. in yii2 basic application directory create an index.php file and fill it as below

    run();
    

    Step 2. Create a .htaccess file in the same base directory as follows

    RewriteEngine on
    # If a directory or a file exists, use it directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Otherwise forward it to index.php
    RewriteRule . index.php
    

提交回复
热议问题