2013-10-24 16 views
3

我搜索如何刪除yii中的index.php。 它的正常工作,但
How to remove index.php in Yii Framework如何在yii中完全刪除index.php當用戶給予重定向url

保護/配置/ main.php

'urlManager'=>array(
     'urlFormat'=>'path', 
     'showScriptName'=>false, 
     'rules'=>array(
      'redirect/<redirectUrl>'=>'site/index', 
      'login'=>'site/login', 
      'privacy'=>'site/privacy', 
      'password'=>'site/forgot', 
      '<controller:\w+>/<id:\d+>'=>'<controller>/view', 
      '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', 
      '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', 
     ), 
    ), 

我htaccess文件

DirectoryIndex index.php 
<IfModule mod_rewrite.c> 
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 
</IfModule> 

當我檢查以下網址

yii.mywebapp .com/index.php?redirecturl = http://www.google.com

它的工作 但我的index.php

yii.mywebapp.com/?redirecturl= http://www.google.com

它也在努力

刪除,但我需要 警予當一些用戶請求重定向URL。 someurl.com/index.php?redirecturl=someurl 我想隱藏的index.php在URL

請幫助

回答

4

將這一規則僅低於你的RewriteEngine On行:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)index\.php([^\s]*) [NC] 
RewriteRule^/%1%2 [R=301,L,NE] 
+0

感謝anubhava它的再次合作nice..once感謝 – Aruljothi

+0

不客氣,很高興它的工作適合你。 – anubhava