Reputation: 483
I am trying to change site url from http://localhost/yiiwebsite/backend/web/index.php url to http://localhost/yiiwebsite/admin and http://localhost/yiiwebsite/frontend/web/index.php url to http://localhost/yiiwebsite/.
Can anyone help me to do this.
Upvotes: 1
Views: 2519
Reputation: 33548
It's described in official docs here.
Here is some basic info:
The application installed according to the above instructions should work out of box with either an Apache HTTP server or an Nginx HTTP server, on Windows, Mac OS X, or Linux running PHP 5.4 or higher. Yii 2.0 is also compatible with facebook's HHVM. However, there are some edge cases where HHVM behaves different than native PHP, so you have to take some extra care when using HHVM.
On a production server, you may want to configure your Web server so that the application can be accessed via the URL
http://www.example.com/index.php
instead ofhttp://www.example.com/basic/web/index.php
. Such configuration requires pointing the document root of your Web server to thebasic/web
folder. You may also want to hideindex.php
from the URL, as described in the Routing and URL Creation section. In this subsection, you'll learn how to configure your Apache or Nginx server to achieve these goals.By setting
basic/web
as the document root, you also prevent end users from accessing your private application code and sensitive data files that are stored in the sibling directories ofbasic/web
. Denying access to those other folders is a security improvement.If your application will run in a shared hosting environment where you do not have permission to modify its Web server configuration, you may still adjust the structure of your application for better security.
Further configuration depends on chosen web server (Nginx / Apache), which is not even mentioned in the questoin. But both options are covered in official docs by the given link.
For shared hosting environment there is special section too.
And by the way this was asked before many times here on SO, just do a better research.
Upvotes: 2