typecho去掉index.php的方法:首先配置服務器的rewrite規則;然后修改nginx以及apache配置;最后在后臺配置typecho偽靜態即可。
銀川網站制作公司哪家好,找創新互聯公司!從網頁設計、網站建設、微信開發、APP開發、自適應網站建設等網站項目制作,到程序開發,運營維護。創新互聯公司公司2013年成立到現在10年的時間,我們擁有了豐富的建站經驗和運維經驗,來保證我們的工作的順利進行。專注于網站建設就選創新互聯公司。
推薦:《PHP視頻教程》
typecho開啟偽靜態,去掉那個討厭的index.php
Typecho后臺設置永久鏈接后,會在域名后加上index.php,很多人都接受不了。例如如下網址:http://qqdie.com/index.php/archives/37/,但我們希望最終的形式是這樣:http://qqdie.com/archives/37.html。那么我們如何做到這樣的效果?
1.配置服務器的rewrite規則
如果在保存上述配置的時候,typecho無法自動配置,那么你可能需要手動配置服務器的rewrite規則。
Linux Apache 環境 (.htaccess):
<IfModule mod_rewrite.c> RewriteEngine On # 下面是在根目錄,文件夾要修改路徑 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] </IfModule> Linux Apache 環境(Nginx): location / { index index.html index.php; if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php) { rewrite (.*) $1/index.php; } if (!-f $request_filename) { rewrite (.*) /index.php; } } Windows IIS 偽靜態 (httpd.ini): [ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # 中文tag解決 RewriteRule /tag/(.*) /index\\.php\\?tag=$1 # sitemapxml RewriteRule /sitemap.xml /sitemap.xml [L] RewriteRule /favicon.ico /favicon.ico [L] # 內容頁 RewriteRule /(.*).html /index.php/$1.html [L] # 評論 RewriteRule /(.*)/comment /index.php/$1/comment [L] # 分類頁 RewriteRule /category/(.*) /index.php/category/$1 [L] # 分頁 RewriteRule /page/(.*) /index.php/page/$1 [L] # 搜索頁 RewriteRule /search/(.*) /index.php/search/$1 [L] # feed RewriteRule /feed/(.*) /index.php/feed/$1 [L] # 日期歸檔 RewriteRule /2(.*) /index.php/2$1 [L] # 上傳圖片等 RewriteRule /action(.*) /index.php/action$1 [L]
nginx 配置
server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*\\.php(\\/.*)*$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } access_log logs/yourdomain.log combined; }
apache 配置
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] </IfModule>
2.后臺配置typecho偽靜態
如圖,在typecho后臺,開啟偽靜態,并選擇你喜好的url形式:
具體操作,根據本人實際操作如下
我的虛擬主機是apache的,在網站根目錄找到.htaccess,有的沒有可能是設置了隱藏文件,顯示隱藏文件就能看到了。
然后編輯.htaccess文件,加入上文中對應的apache配置代碼保存。然后去typecho程序后臺,設置>永久鏈接,按照上文中圖片的設置,保存即可。
標題名稱:typecho去掉index.php的方法
路徑分享:http://vcdvsql.cn/article16/chsogg.html
成都網站建設公司_創新互聯,為您提供標簽優化、網站改版、品牌網站制作、網站營銷、靜態網站、軟件開發
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯