導航:首頁 > 編程語言 > yii去掉indexphp

yii去掉indexphp

發布時間:2023-08-17 15:37:28

① thinkphp iis 如何去掉index.php

[ IIS ]

如果你的伺服器環境支持ISAPI_Rewrite的話,可以配置httpd.ini文件,添加下面的內容:

RewriteRule(.*)$/index.php?s=$1[I]

在IIS的高版本下面可以配置web.Config,在中間添加rewrite節點:

<rewrite>
<rules>
<rulename="OrgPage"stopProcessing="true">
<matchurl="^(.*)$"/>
<conditionslogicalGrouping="MatchAll">
<addinput="{HTTP_HOST}"pattern="^(.*)$"/>
<addinput="{REQUEST_FILENAME}"matchType="IsFile"negate="true"/>
<addinput="{REQUEST_FILENAME}"matchType="IsDirectory"negate="true"/>
</conditions>
<actiontype="Rewrite"url="index.php/{R:1}"/>
</rule>
</rules>
</rewrite>

參考文檔:http://www.kancloud.cn/manual/thinkphp/1866

② 如何去掉index.php目錄

apache去掉index.php
1.編輯conf/httpd.conf配置文件
#LoadMole rewrite_mole moles/mod_rewrite.so 把該行前的#去掉
同時對應Directory下要配置 AllowOverride All
2.在 CI 根目錄下(即在index.php,system的同級目錄下)新建立一個配置文件,命名為: .htaccess 內容如下:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(application|moles|plugins|system|themes) index.php/$1 [L]
3.把system/application/config/config.php 中$config['index_page'] = "index.php";改為$config['index_page'] = "";
4.重啟apache
php CI 實戰教程:[9]如何去掉index.php目錄
nginx去掉index.php
1.編輯nginx.conf文件
vi /usr/local/xxxxx/nginx/conf/nginx.conf
#nginx去掉index.php
location / {
rewrite ^/$ /index.php last;
#防止某些文件夾被直接訪問
rewrite ^/(?!index\.php|robots\.txt|uploadedImages|resource|images|js|css|styles|static)(.*)$ /index.php/$1 last;
}
2.config/config.php下配置$config['index_page'] = '';
3..重啟nginx
去掉默認的index方法,如圖的URL配置如:
config/routes.php,配置$route['catalogues/(:any)'] = "catalogues/index/$1";
其中(:any)表示匹配所有除CI保留關鍵字外的內容,後面的$1為index傳入的參數內容。
多個參數採用多個(:any),如兩個參數的為:$route['catalogues/(:any)/(:any)'] = "catalogues/index/$1/$2";
註:route規則如果同一目錄下精確配置要在模糊配置上面,否則不起作用,如:
$route['catalogues/more'] = "catalogues/more";
$route['catalogues/(:any)'] = "catalogues/index/$1";
php CI 實戰教程:[9]如何去掉index.php目錄
END
注意事項
route規則如果同一目錄下精確配置要在模糊配置上面,否則不起作用
nginx伺服器不需要.htaccess文件

③ EyouCms怎麼去除URL中的index.php

④ 網址中間的index.php怎麼去掉,看了一些回答不知道怎麼做,希望能回答,解決了多給分,一定的。

使用URL重寫,可以使網站的URL屏蔽index.php這種不友好的網址。
假如你的web伺服器端使用的是apache,那麼你需要開啟mod_rewrite.so模塊,
為網站在apache配置文件中的<Directory>配置節添加如下內容,
Options FollowSymLinks
AllowOverride ALL
Order allow,deny
Allow from all
然後在網站根目錄下創建一個 .htaccess 文件,內容如下
<IfMole mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfMole>

就可以在網址中屏蔽index.php了

⑤ php怎麼辦url中的index.php去掉

為美觀一些,去掉CI默認url中的index.php。分三步操作:

1.打開apache的配置文件,conf/httpd.conf :

LoadMole rewrite_mole moles/mod_rewrite.so,把該行前的#去掉。

搜索 AllowOverride None(配置文件中有多處),看注釋信息,將相關.htaccess的該行信息改為AllowOverride All。

2.在CI的根目錄下,即在index.php,system的同級目錄下,建立.htaccess,直接建立該文件名的不會成功,可以先建立記事本文件,另存為該名的文件即可。內容如下(CI手冊上也有介紹):

RewriteEngine on

RewriteCond $1 !^(index/.php|images|robots/.txt)

RewriteRule ^(.*)$ /index.php/$1 [L]

如果文件不是在www的根目錄下,例如我的是:http://localhost/CI/index.php/,第三行需要改寫為RewriteRule ^(.*)$ /CI/index.php/$1 [L]。

另外,我的index.php的同級目錄下還有js文件夾和css文件夾,這些需要過濾除去,第二行需要改寫為:RewriteCond $1 !^(index/.php|images|js|css|robots/.txt)。

3.將CI中配置文件(system/application/config/config.php)中$config['index_page'] = "index.php";將$config['index_page'] = ""; 。

ok,完成。還要記得重啟apache。

閱讀全文

與yii去掉indexphp相關的資料

熱點內容
java繼承類實例 瀏覽:286
疫情期間程序員的工資 瀏覽:27
最好的python編譯器 瀏覽:187
安卓手機如何調分屏 瀏覽:729
安卓系統藍牙耳機如何用 瀏覽:719
為什麼微信不能給appstore充值 瀏覽:495
程序員的保護動物 瀏覽:274
程序員遇到問題去哪個網站 瀏覽:531
安卓手機空格鍵連續輸入怎麼取消 瀏覽:520
壓縮空氣管道流量計 瀏覽:564
ug編程高級教程 瀏覽:177
什麼叫做伺服器已滿 瀏覽:37
暑假哪有教演算法的 瀏覽:136
密碼學的根基是加密 瀏覽:662
stata方差檢驗命令 瀏覽:337
解壓後文件夾里的內容丟失 瀏覽:715
解壓無敵視頻 瀏覽:690
什麼是伺服器辨認不了 瀏覽:129
java如何調用類方法 瀏覽:483
管理孩子的app叫什麼 瀏覽:546