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

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

问题描述

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

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

我的Yii是这样设置的

My Yii is set up like this

/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

如何从 URL 中删除应用程序"部分.

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,或者让框架文件夹位于 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/(并将 yii 放在/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天全站免登陆