導航:首頁 > 編程語言 > 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相關的資料

熱點內容
程序員和施工員哪個有前途 瀏覽:614
浙江百兆伺服器雲空間 瀏覽:827
php和html5學哪個比較好 瀏覽:388
瑜伽pdf下載地址 瀏覽:252
小花貓app改名叫什麼 瀏覽:837
編程器固件修改 瀏覽:523
沈陽技校有程序員嗎 瀏覽:300
各行app的基金有什麼不一樣嗎 瀏覽:62
python編譯器怎麼裝 瀏覽:73
新浪php筆試題 瀏覽:138
新時達伺服器如何自學習 瀏覽:27
程序中什麼命令用來輸入單字元 瀏覽:59
php是否有數據 瀏覽:141
虛擬雲伺服器是什麼意思 瀏覽:279
vb是編譯性語言嗎 瀏覽:209
json格式用什麼編譯器 瀏覽:319
word轉pdf代碼 瀏覽:802
單片機中如何編程 瀏覽:739
cad常見的快捷命令 瀏覽:625
伺服器端有什麼 瀏覽:325