Friendly Urls

I have created an application that uses application directories so I have a frontend and backend. I want to setup friendly urls for both and I do not want to show the scriptfile.

Three example urls before adding friendly urls:

Once I add in friendly urls, those example urls might be:

How do I configure the system so that it would know that a request for front or products goes to index.php and a request for back goes to backend.php. There could also be scenarios where the frontend and backend have the same friendly url path, ie

I have a config file for each application and am planning on putting the friendly urls in each applications config file so they will be separate but I don’t know how the system will know which scriptfile to use when a friendly url request comes in.

I don’t know if I need to do something in urlManager’s rules or in the .htaccess to accomplish this or if it is even possible?



Haven’t done this before, but my initial thought tells me you should do it in the Apache’s mod_rewrite level.

Read this section of the guide.

If you need further assistance, ask again in the forum!

Step 1 – in config/main.php

return array(






            'showScriptName'=>false, //ADDED


Step 2 – in <<root>>/.htaccess


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


After you finish the above steps, you can access your pages as…