2014-12-22 38 views
0

當使用如何刪除後附加斜槓警予

Yii::app()->createUrl('/page/'); 

它additing額外的尾部斜槓的URL LIKE http://www.sitename//http://www.sitename//page

,我需要排除兩個斜槓,應用程序URL經理是跟着,

'urlManager' => array(
     'urlFormat' => 'path', 
     'showScriptName' => false, 
     'urlSuffix' => '/', 
     'rules' => array(
      'site/news_letter_unsubsubscribe/<id:\w+>' => 'site/news_letter_unsubsubscribe', 
      'page/<id:[\w\-]+>' => 'page/index/', 
      'site/blog_detail/<id:[\w\-]+>' => 'site/blog_detail', 
      'location/<id:[\w\-]+>' => 'location/index', 
      'auth/partner_detail/<id:[\w\-]+>' => 'auth/partner_detail', 
      //'tour/tour_detail/<id:\w+>/<date:\w+>'=>'tour/tour_detail', 
      'activity/activity_detail/<id:[\w\-]+>' => 'activity/activity_detail', 
      'activity/compare_detail/<id:[\w\-]+>' => 'activity/compare_detail', 
      'tour/tour_detail/<id:[\w\-]+>' => 'tour/tour_detail', 
      'tour/compare_detail/<id:[\w\-]+>' => 'tour/compare_detail', 
      '<controller:\w+>/<id:\d+>' => '<controller>/view', 
      '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', 
      '<controller:\w+>/<action:\w+>' => '<controller>/<action>', 
      'auth/reset_password/<id:\w+>' => 'auth/reset_password', 
      'site/linkedin_login/<id:\w+>' => 'site/linkedin_login', 

     ), 
    ) 

的.htaccess規則

RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA] 
+1

從urlManager刪除urSuffix「/」,並給它一個嘗試。 – TNC

+0

不,不是因爲回覆我不是這個問題 – TED

回答

2

在Yii2中你的代碼是錯誤的。您正在閱讀doc!例如:

echo \Yii::$app->urlManager->createUrl('page'); 
+0

,我糾正了這個問題。但在域名後仍然顯示兩個斜線 – TED

+0

讓我看看您的代碼 – Fortran

+0

我可以對此問題進行排序從請求基URL中刪除後綴斜槓Thx – TED

0

我能解決這問題的要求基本URL去掉後綴斜線

感謝