迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發(fā)框架,基于MIT開源許可協(xié)議發(fā)布,免費且不限制商業(yè)使用,是免費開源的產(chǎn)品,以萬端互聯(lián)為設(shè)計理念,支持的微信公眾號、小程序、APP客戶端、移動端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
聯(lián)系官方銷售客服
1835022288
028-61286886
域名后面帶index.php 如何進(jìn)行301跳轉(zhuǎn)取消index.php
回復(fù)@龍帝 現(xiàn)在域名后出現(xiàn)index.php,我想做URL規(guī)范化,就是取消index.php,直接跳轉(zhuǎn)到域名上。
回復(fù)@華清陽君
# index.php 301跳轉(zhuǎn)代碼!
RewriteCond %{THE_REQUEST} /index\.php [NC]
# index.php 301跳轉(zhuǎn)主頁!
RewriteRule ^index\.php$ http://www.hrbpinpaicehua.com/ [R=301,L]
# /index.php/ index.php目錄跳轉(zhuǎn)主頁!
RewriteRule ^index\.php/$ http://www.hrbpinpaicehua.com/ [R=301,L]
# /index.php/目錄/ 跳轉(zhuǎn)!
RewriteRule ^index.php/([a-zA-Z]+)/?$ http://www.hrbpinpaicehua.com/$1/ [L,R=301,QSA]
# /index.php/目錄/數(shù)字.html 跳轉(zhuǎn)!新聞頁面使用
RewriteRule ^index.php/([a-zA-Z]+)/(\d+).html$ http://www.hrbpinpaicehua.com/$1/$2.html [L,R=301,QSA]
# /index.php/目錄/數(shù)字_分頁.html 跳轉(zhuǎn)!欄目分頁使用
RewriteRule ^index.php/([a-zA-Z]+)/(\d+)_(\d+)\.html$ http://www.hrbpinpaicehua.com/$1/$2_$3.html [L,R=301,QSA]
# /index.php/英文字母.html 跳轉(zhuǎn)!聚合資訊根目錄單頁使用
RewriteRule ^index.php/([a-zA-Z]+)\.html$ http://www.hrbpinpaicehua.com/$1.html [L,R=301,QSA]
# /index.php/英文字母/英文字母.html 跳轉(zhuǎn)!tag標(biāo)簽使用
RewriteRule ^index.php/([a-zA-Z]+)/([a-zA-Z]+)\.html$ http://www.hrbpinpaicehua.com/$1/$2.html [L,R=301,QSA]
# /index.php/英文字母/英文字母-p數(shù)字.html 跳轉(zhuǎn)!tag標(biāo)簽分頁使用
RewriteRule ^index.php/([a-zA-Z]+)/([a-zA-Z]+)-p(\d+)\.html$ http://www.hrbpinpaicehua.com/$1/$2-p$3.html [L,R=301,QSA]
# /index.php/英文字母/英文字母.xml 跳轉(zhuǎn)!網(wǎng)站地圖使用
RewriteRule ^index.php/([a-zA-Z]+).xml$ http://www.hrbpinpaicehua.com/$1.xml [L,R=301,QSA]
# /index.php/英文字母.txt 跳轉(zhuǎn)!網(wǎng)站地圖使用
RewriteRule ^index.php/([a-zA-Z]+).txt$ http://www.hrbpinpaicehua.com/$1.txt [L,R=301,QSA]
.htaccess文件做了點規(guī)則,目前驗證是沒有問題的。
回復(fù)@龍帝 現(xiàn)在域名后出現(xiàn)index.php,我想做URL規(guī)范化,就是取消index.php,直接跳轉(zhuǎn)到域名上。
回復(fù)@華清陽君
# index.php 301跳轉(zhuǎn)代碼!
RewriteCond %{THE_REQUEST} /index\.php [NC]
# index.php 301跳轉(zhuǎn)主頁!
RewriteRule ^index\.php$ http://www.hrbpinpaicehua.com/ [R=301,L]
# /index.php/ index.php目錄跳轉(zhuǎn)主頁!
RewriteRule ^index\.php/$ http://www.hrbpinpaicehua.com/ [R=301,L]
# /index.php/目錄/ 跳轉(zhuǎn)!
RewriteRule ^index.php/([a-zA-Z]+)/?$ http://www.hrbpinpaicehua.com/$1/ [L,R=301,QSA]
# /index.php/目錄/數(shù)字.html 跳轉(zhuǎn)!新聞頁面使用
RewriteRule ^index.php/([a-zA-Z]+)/(\d+).html$ http://www.hrbpinpaicehua.com/$1/$2.html [L,R=301,QSA]
# /index.php/目錄/數(shù)字_分頁.html 跳轉(zhuǎn)!欄目分頁使用
RewriteRule ^index.php/([a-zA-Z]+)/(\d+)_(\d+)\.html$ http://www.hrbpinpaicehua.com/$1/$2_$3.html [L,R=301,QSA]
# /index.php/英文字母.html 跳轉(zhuǎn)!聚合資訊根目錄單頁使用
RewriteRule ^index.php/([a-zA-Z]+)\.html$ http://www.hrbpinpaicehua.com/$1.html [L,R=301,QSA]
# /index.php/英文字母/英文字母.html 跳轉(zhuǎn)!tag標(biāo)簽使用
RewriteRule ^index.php/([a-zA-Z]+)/([a-zA-Z]+)\.html$ http://www.hrbpinpaicehua.com/$1/$2.html [L,R=301,QSA]
# /index.php/英文字母/英文字母-p數(shù)字.html 跳轉(zhuǎn)!tag標(biāo)簽分頁使用
RewriteRule ^index.php/([a-zA-Z]+)/([a-zA-Z]+)-p(\d+)\.html$ http://www.hrbpinpaicehua.com/$1/$2-p$3.html [L,R=301,QSA]
# /index.php/英文字母/英文字母.xml 跳轉(zhuǎn)!網(wǎng)站地圖使用
RewriteRule ^index.php/([a-zA-Z]+).xml$ http://www.hrbpinpaicehua.com/$1.xml [L,R=301,QSA]
# /index.php/英文字母.txt 跳轉(zhuǎn)!網(wǎng)站地圖使用
RewriteRule ^index.php/([a-zA-Z]+).txt$ http://www.hrbpinpaicehua.com/$1.txt [L,R=301,QSA]
.htaccess文件做了點規(guī)則,目前驗證是沒有問題的。