yii-url-manager

YII 2 Get Site URL

无人久伴 提交于 2020-08-06 07:50:30
问题 My Application is deployed on localhost/upload. I am using following code to generate relative URL. Url::to('@web/my_controller/action'); // it returns /upload/my_controller/action But, I need full URL like this instead: http://localhost/upload/my_controller/action. Am I missing something? 回答1: You should simply use a route : Url::to(['my_controller/action']); And if you want an absolute base url : Url::to(['my_controller/action'], true); Read more : http://www.yiiframework.com/doc-2.0/yii

Yii Application works fine on localhost, but throws “not found” error on GoDaddy.com

杀马特。学长 韩版系。学妹 提交于 2020-02-08 04:56:02
问题 My Yii site works perfectly fine, when run on my laptop (localhost). But, when copied to GoDaddy.com and run from there, I'm getting following error message: Not Found The requested URL /website/Search_Best_Boat_Deals was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache Server at website.com Port 80 My main.php configuration file has the following configuration for URL management 'urlManager'=

Yii Application works fine on localhost, but throws “not found” error on GoDaddy.com

元气小坏坏 提交于 2020-02-08 04:55:35
问题 My Yii site works perfectly fine, when run on my laptop (localhost). But, when copied to GoDaddy.com and run from there, I'm getting following error message: Not Found The requested URL /website/Search_Best_Boat_Deals was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache Server at website.com Port 80 My main.php configuration file has the following configuration for URL management 'urlManager'=

Yii2 Clean URLs & Action Parameters

血红的双手。 提交于 2020-01-13 13:10:00
问题 I've enabled clean URLs on my Yii2 application, but I can't seem to get arguments to pass to the action. I expect this: localhost/app/web/a/b/c/d To map to the following: AController->actionB($c, $d) It's not happening. Here's my .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php The relevant part of my web.php: 'urlManager' => [ 'class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false,

Yii2 url manager don't parse urls with get parameter

只谈情不闲聊 提交于 2019-12-24 00:51:22
问题 I've created a module named catalogue with, for the moment, two actions in the default controller: actionIndex actionLineProducts in the index view I have some link which run the line-product's action, the url was the result of: Url::to(['line-products', 'line' => $line->name]) my goal is to obtain a link like catalogue/{line-name} where line-name is the parameter I send to action LineProducts. My urlManager configurations are: 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' =>

Changing pattern of url to accept username like facebook

江枫思渺然 提交于 2019-12-23 05:20:03
问题 I need to covert user profile link from this http://example.com/site/index?user_id=sami.yaqoub To be like Facebook http://example.com/sami.yaqoub I changed the rules of config file to except that. Config.php <?php .. 'urlManager' => array( 'urlFormat' => 'path', 'showScriptName' => false, 'rules' => array( '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', '<user:

Passing multiple parameters in a hyperlink in yii2 with clean urls, Html::a() doesnt generate clean url

ぐ巨炮叔叔 提交于 2019-12-22 03:48:16
问题 I am trying to generate a hyper link by the method mentioned in http://www.yiiframework.com/doc-2.0/guide-helper-html.html#hyperlinks like this Html::a('<b>Register</b>', ['story/create', array('id' =>39,'usr'=>'11')], ['class' => 'profile-link']) I want to get url like story/create/id/39/usr/11 But it is generating as story/create?1%5Bid%5D=39&1%5Busr%5D=1 I have enabled the clean url functionality of yii2 like 'urlManager' => [ 'class' => 'yii\web\UrlManager', // Disable index.php

URL contain % ,%2f would be a / and the %3d a = In yii?

限于喜欢 提交于 2019-12-13 21:31:28
问题 My url in yii is: http://localhost/php_pro_106/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG%2Fg0jJFWjiWWdPnkq5VDlY%3D what should I have to do in url manager to get this,My current rule is: '<controller:\w+>/ByCustomer/<giftcode>'=>'<controller>/ByCustomer', Actually problem is that I get : The requested URL /php_pro_106/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG/g0jJFWjiWWdPnkq5VDlY= was not found on this server. It is due to %3D %2F in the URL.What I have to do to make it work fine? 回答1: I know

Yii2 URL manager rules and forms with GET method

送分小仙女□ 提交于 2019-12-13 20:02:49
问题 I have a global search form that submits to search action of a controller: <?=Html::beginForm(['/feqh/search'], 'get', ['class' => 'navbar-form navbar-left', 'role' => 'search', 'id' => 'searchForm']);?> <div class="form-group has-feedback Right"> <input id="q" type="text" class="form-control" placeholder="<?=yii::t('app','Search');?>" name="q" value="<?= Html::encode(\Yii::$app->getRequest()->getQueryParam('q',""));?>" /> <i class="form-control-feedback glyphicon glyphicon-search"></i> </div