site urls

I’ve read the tutorial on setting up friendly urls, but still have an issue. I have my site structure like the following:




Inside of /site I have:





To access my site, you go to:

To go to the contact page:

I would like to get rid of the first ‘site’ from the url, so you can access it at: and

My .htaccess file is 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

I know I could remove the ‘site’ directory and put all the directories in it one level higher, but I would like to keep the directory structure as it is. Is there a way to solve this problem with an .htaccess file modification?


try and add

RewriteBase /

RewriteCond %{REQUEST_URI} !^/site/.*$

RewriteRule ^(.*)$ /site/$1

to your .htaccess !

be aware that yii will continue to create urls based on your directory structure