mod-rewriteyiiappfog

Yii removing application directory name from URL


Okay seems like this is a pretty common problem, but I can't find a definitive solution on the forums.

My Yii is set up like this

/webroot/framework
/webroot/app
/webroot/requirements

The app folder hosts the yii application

however my url looks like : site[dot]com/app/site/index

How do I remove the 'app' portion from the URL.

I tried moving my .htaccess file to the webroot folder and it redirects but 'app' still shows up in the url

Here are the contents of /webroot/.htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # need this for AMZN ELB or get a infinite redirect loop 
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteCond %{SERVER_NAME} !^localhost$
  RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI} [L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteRule . /app/index.php 
</IfModule>

I would be easy if I could just change my webroot to /webroot/app but I can't control that. Thanks for any help..

This is launched on appfog so I can't control the webroot, or have the framework folder live one directory above the webroot.


Solution

  • May be you can move all files from /webroot/app to /webroot/ (and place yii at /webroot/yii).