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:

/framework

/requirements

/site

Inside of /site I have:

/assets

/protected

/themes

.htaccess

To access my site, you go to: http://www.mysite.com/site

To go to the contact page: http://www.mysite.com/site/site/contact

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

http://www.mysite.com and http://www.mysite.com/site/contact

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?

hello,

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

:)