从yii2中的前端和后端删除web文件夹后,从url中删除index.php

时间:2015-09-18 06:24:39

标签: yii2 yii2-advanced-app

我想从网址中删除.htaccess。我将common/config/main-local.php放在根目录中,并在.htaccess中写下以下几行 但是每个网址都被重定向到后端。

我的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 文件:

common/config/main-local.php

我的'urlManager' => [ 'class' => 'yii\web\UrlManager', // Disable index.php 'showScriptName' => false, // Disable r= routes 'enablePrettyUrl' => true, 'rules' => array( '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ), ], 文件:

index.php

注意:我想从前端和后端删除func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool { println("URL : \(url)") if(url.scheme!.isEqual("fb1627825840806667")) { println("Facebook url scheme") return FBSDKApplicationDelegate.sharedInstance().application( application, openURL: url, sourceApplication: sourceApplication, annotation: annotation) } else { println("Google+ url scheme") return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation) } }

1 个答案:

答案 0 :(得分:-1)

在.htaccess文件中(在前端/ web和后端/ web中放置.htaccess)

Caused by: org.gradle.api.GradleException: Unable to create lint output directory.

在frontend / config / main.php和backend / config / main.php中:

RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php