目錄和文件型模式是35dir偽靜態的主要方式。昨天轉移空間結果偽靜態全部失效了,于是怎么都沒有修改成功。于是果斷在網上參考了以下并對原代碼加以修改:
# BEGIN RewriteEngine On # 首頁、分類瀏覽、數據歸檔、最近更新、排行榜、意見反饋 RewriteRule ^(index|webdir|weblink|article|category|update|archives|top|feedback|link|rssfeed|sitemap)(\.html)$ index.php\?mod=$1&%1 RewriteRule ^(index|webdir|weblink|article|category|update|archives|top|feedback|link|rssfeed|sitemap)(\/?)$ index.php\?mod=$1 # 最近更新 RewriteRule ^update-(\d+)-(\d+)\.html$ index.php\?mod=update&days=$1&page=$2 RewriteRule ^update\/(\d+)-(\d+)\.html$ index.php\?mod=update&days=$1&page=$2 RewriteRule ^update\/(\d+)/(\d+)$ index.php\?mod=update&days=$1&page=$2 # 數據歸檔 RewriteRule ^archives-(\d+)-(\d+)\.html$ index.php\?mod=archives&date=$1&page=$2 RewriteRule ^archives\/(\d+)-(\d+)\.html$ index.php\?mod=archives&date=$1&page=$2 RewriteRule ^archives\/(\d+)/(\d+)$ index.php\?mod=archives&date=$1&page=$2 # 站內搜索 RewriteRule ^search-(name|url|tags|intro)-(.*)-(\d+)\.html$ index.php\?mod=search&type=$1&query=$2&page=$3 RewriteRule ^search-(name|url|tags|intro)-(.*)\.html$ index.php\?mod=search&type=$1&query=$2 RewriteRule ^search\/(name|url|tags|intro)\/(.*)-(\d+)\.html$ index.php\?mod=search&type=$1&query=$2&page=$3 RewriteRule ^search\/(name|url|tags|intro)\/(.*)\.html$ index.php\?mod=search&type=$1&query=$2 RewriteRule ^search\/(name|url|tags|intro)\/(.+)/(\d+)$ index.php\?mod=search&type=$1&query=$2&page=$3 RewriteRule ^search\/(name|url|tags|intro)\/(.+)$ index.php\?mod=search&type=$1&query=$2 # 站點詳細 RewriteRule ^siteinfo-(\d+)\.html$ index.php\?mod=siteinfo&wid=$1 RewriteRule ^siteinfo\/(\d+)\.html$ index.php\?mod=siteinfo&wid=$1 RewriteRule ^siteinfo\/(\d+)$ index.php\?mod=siteinfo&wid=$1 # 文章詳細 RewriteRule ^artinfo-(\d+)\.html$ index.php\?mod=artinfo&aid=$1 RewriteRule ^artinfo\/(\d+)\.html$ index.php\?mod=artinfo&aid=$1 RewriteRule ^artinfo\/(\d+)$ index.php\?mod=artinfo&aid=$1 # 鏈接詳細 RewriteRule ^linkinfo-(\d+)\.html$ index.php\?mod=linkinfo&lid=$1 RewriteRule ^linkinfo\/(\d+)\.html$ index.php\?mod=linkinfo&lid=$1 RewriteRule ^linkinfo\/(\d+)$ index.php\?mod=linkinfo&lid=$1 # 單頁 RewriteRule ^diypage-(\d+)\.html$ index.php\?mod=diypage&pid=$1 RewriteRule ^diypage\/(\d+)\.html$ index.php\?mod=diypage&pid=$1 RewriteRule ^diypage\/(\d+)$ index.php\?mod=diypage&pid=$1 # RSS RewriteRule ^rssfeed-(.+)-(\d+)\.html$ index.php\?mod=rssfeed&type=$1&cid=$2 RewriteRule ^rssfeed-(.+)\.html$ index.php\?mod=rssfeed&type=$1&cid=$2 RewriteRule ^rssfeed\/(.+)/$ index.php\?mod=rssfeed&type=$1 RewriteRule ^rssfeed\/(.+)/(\d+)\.html$ index.php\?mod=rssfeed&type=$1&cid=$2 RewriteRule ^rssfeed\/(.+)$ index.php\?mod=rssfeed&type=$1 RewriteRule ^rssfeed\/(.+)/(\d+)$ index.php\?mod=rssfeed&type=$1&cid=$2 # SiteMap RewriteRule ^sitemap-(.+)\.html$ index.php\?mod=sitemap&cid=$1 RewriteRule ^sitemap\/(\d+)\/$ index.php\?mod=sitemap&cid=$1 RewriteRule ^sitemap\/(\d+)$ index.php\?mod=sitemap&cid=$1 # 分類目錄 RewriteRule ^webdir-(.+)-(\d+)-(\d+)\.html$ index.php\?mod=webdir&cid=$2&page=$3 RewriteRule ^webdir\/(.+)\/(\d+)-(\d+)\.html$ index.php\?mod=webdir&cid=$2&page=$3 RewriteRule ^webdir\/(.+)\/(\d+)/(\d+)$ index.php\?mod=webdir&cid=$2&page=$3 RewriteRule ^article-(.+)-(\d+)-(\d+)\.html$ index.php\?mod=article&cid=$2&page=$3 RewriteRule ^article\/(.+)\/(\d+)-(\d+)\.html$ index.php\?mod=article&cid=$2&page=$3 RewriteRule ^article\/(.+)\/(\d+)/(\d+)$ index.php\?mod=article&cid=$2&page=$3 # END
這里你只需要用以上代碼重新建立一個.htaccess文件覆蓋根目錄的該文件即可。
相關標簽: # 35dir偽靜態規 # 偽靜態規則 # 偽靜態 # .htaccess