.htaccess這個模塊是apache的一個算是叫擴展示模板吧,要能讓它可以運行必須在RewriteEngine:讓下面的rewrite功能打開或關閉。on是打開;off是關閉,可以的。
重定向老域名.com到www.新域名.com
- RewriteEngine On
- RewriteCond %{HTTP_HOST} !老域名.com$ [NC]
- RewriteRule ^(.*)$ http://www.新域名.com/$1 [L,R=301]
重定向老域名.com to 新域名.com
- RewriteEngine On
- RewriteBase /
- RewriteCond %{HTTP_HOST} !老域名.com$ [NC]
- RewriteRule ^(.*)$ http://新域名.com/$1 [L,R=301]
重定向domain.com/file/file.php 到 otherdomain.com/otherfile/other.php
- RewriteCond %{HTTP_HOST} ^www.domain.com$
- RewriteRule ^file/file.php$ http://www.otherdomain.com/otherfile/other.php [R=301,L]
- RewriteBase /news
- RewriteCond %{HTTP_HOST} ^Vevb.com [NC]
- RewriteRule com(.*)$ http://www.companysz.com$1 [L,R=301]
- RewriteCond %{HTTP_HOST} ^Vevb.com [NC]
- RewriteRule (.*)$ http://www.companysz.com/news/$1 [L,R=301]
- RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]
- RewriteRule com(.*)$ http://www.companysz.com$1 [L,R=301]
- RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]
- RewriteRule (.*)$ http://www.companysz.com/news/$1 [L,R=301]
# 修改以下語句中的 /discuz 為你的論壇目錄地址,如果程序放在根目錄中,請將 /discuz 修改為 / RewriteBase /
- RewriteCond %{HTTP_HOST} !^www.companysz.com$ [NC]
- RewriteRule ^(.*)$ http://www.companysz.com/$1 [L,R=301]
- RewriteRule ^archiver/((fid|tid)-[w-]+.html)$ archiver/index.php?$1
- RewriteRule ^forum-([0-9]+)-([0-9]+).html$ forumdisplay.php?fid=$1&page=$2
- RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+).html$ viewthread.php?tid=$1&extra=page%3D$3&page=$2
- RewriteRule ^space-(username|uid)-(.+).html$ space.php?$1=$2
- RewriteRule ^tag-(.+).html$ tag.php?name=$1
新聞熱點
疑難解答