Heim  >  Artikel  >  php教程  >  yii url 隐藏index.php的步骤

yii url 隐藏index.php的步骤

WBOY
WBOYOriginal
2016-06-06 19:49:331303Durchsuche

一。修改config/下的main.php里的 'urlManager'= array ( 'urlFormat'='path', span style="color:#e53333;"'showScriptName'= false ,/span 'rules'= array ( 'controller:\w+/id:\d+'='controller/view', 'controller:\w+/action:\w+/id:\d+'='controller/

一。修改config/下的main.php里的

'urlManager'=><span>array</span><span>(
            </span>'urlFormat'=>'path',
            <span style="color:#e53333;">'showScriptName'=><span>false</span>,</span>          <br>   'rules'=><span>array</span><span>(
            </span>'<controller:>/<id:>'=>'<controller>/view',
            '<controller:>/<action:>/<id:>'=>'<controller>/<action>',
            '<controller:>/<action:>'=>'<controller>/<action>',<span>
            )</span>,<span>
          )</span>,</action></controller></action:></controller:></action></controller></id:></action:></controller:></controller></id:></controller:>

二。修改网站根目录下.htaccess文件内容如下 

Options +<span>FollowSymLinks
IndexIgnore </span>*<span>/*</span><span>
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</span>

 三。在wamp中,apeach 中 的http.conf 文件中有个 rewrite, 要打开。

<span>#</span> LoadModule rewrite_module modules/mod_rewrite.so

要将 ‘#’ 给删除。

完成以上三步,就可以在网址 那里,去掉 index.php 隐藏。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn