Yii从URL删除应用程序目录名称 [英] Yii removing application directory name from URL

查看:101
本文介绍了Yii从URL删除应用程序目录名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,这似乎是一个很普遍的问题,但是我在论坛上找不到明确的解决方案.

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

我的Yii设置如下

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

app文件夹托管yii应用程序

The app folder hosts the yii application

但是我的网址看起来像:site [dot] com/app/site/index

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

如何从网址中删除应用"部分.

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

我尝试将.htaccess文件移动到webroot文件夹,并且重定向,但"app"仍显示在url中

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

这是/webroot/.htaccess的内容

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>

如果我可以将我的webroot更改为/webroot/app,但我无法控制,那将很容易.感谢您的帮助.

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

这是在appfog上启动的,因此我无法控制webroot,或者使framework文件夹位于webroot上方的一个目录中.

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

推荐答案

也许您可以将所有文件从/webroot/app移至/webroot/(并将iii放在/webroot/yii中).

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

这篇关于Yii从URL删除应用程序目录名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆