對於學建站新手,推薦剛開始使用 WordPress 程序學習做網站,由於 WordPress 是 PHP 程序,它與 LINUX 空間配合很好,但仍有很多做網站新手會購買到 windows 屬性空間,就導致了安裝 WordPress 程序之後,偽靜態出現鏈接中含有 index.php 的情況。

那麼如何去除鏈接中的 index.php 呢?有二個方法,一個是使用插件,另一種是使用純代碼修改。下面講講如何使用無插件純代碼方式去除網站鏈接中的 index.php 。

首先桌面新建一個 txt 文本,然後複製以下代碼至 txt 文件中:

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based WordPress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal WordPress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

然後保存文本文件為 httpd.ini 文件;再將 httpd.ini 文件上傳至自己做網站的空間根目錄。再次刷新網站首頁,就會看到鏈接中的 index.php 被去除了。