Pretty Urls

Hello, my name is Sergey!

My issue is the next one:

I am using advanced app template which is separated into backend and frontend as you know. And I want to make pretty urls. I have read all documentation about this, a lot of guides, but there is no any effect.

My steps:

1)I have put these lines

 'urlManager' => [

           'enablePrettyUrl' => true,

            'showScriptName' => false,


and I have used Recommended Nginx Configuration.

It gave me urls like these:

localhost/ and localhost/

But I need urls without frontend/web and backend/web. I need frontend url = localhost/ and backend url = localhost/ I think that I have to do some overrides in the nginx conf file, but I dont know how to do that.

And I have one more task: create url with subdomain, like this - "localhost/"

Could anybody help me to resolve my issues?

Thank you in advance!

add .htaccess file

here is a sample

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

Thank you for your answer, but i am using Nginx… And it doesnt support htaccess

nginx should work by default if you’re using config similar to the one in the guide.

Yeah I just did it the other day following the nginx config in the guide -

Thank you, I will try one more. Maybe, I have some mistakes.

Keith Slater , could you give me your nginx configuration file if it is possible for you?

Could you say me what is wrong in my conf file:

server {

set $yii_bootstrap "index.php";

charset utf-8;

client_max_body_size 128M;

listen 80; ## listen for ipv4

#listen [::]:80 default_server ipv6only=on; ## listen for ipv6

server_name localhost;

root        C:/server/www;

index       $yii_bootstrap;

access_log C:/server/nginx/logs/access.log;

error_log C:/server/nginx/logs/error.log;

location / {

    # Redirect everything that isn't real file to yii bootstrap file including arguments.

    try_files $uri $uri/ /$yii_bootstrap?$args;


# uncomment to avoid processing of calls to unexisting static files by yii

#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {

#    try_files $uri =404;


#error_page 404 /404.html;

location ~ \.php$ {

    include fastcgi.conf;


    #fastcgi_pass unix:/var/run/php5-fpm.sock;


location ~ /\.(ht|svn|git) {

    deny all;



The main problem is that i am using advanced app template, and when im typing, nginx cannot redirect me, because next path is being generated -, but index.php located in the frontend/web/ and backend/web, so nginx could not find index file.