Rewrite&Redirect

在apache資料夾中的httpd.conf

(也可以在資料夾中放.htaccess檔來設定)
設定超連結RewriteRule

<IfModule rewrite_module>
RewriteLogLevel 3
Rewritelog /var/log/rewrite.log
Redirect permanent /one http://www.google.com
# http://1.1.1.1/one 往 http://www.google.com 導
RewriteEngine on
#開啟Rewrite功能


RewriteRule ^/line\.gif$ /line.gif [PT]
RewriteRule ^/$ http://www.kimo.com.tw [R]
# http://1.1.1.1/ 往 http://www.kimo.com.tw 導
#[R] 表示Redirect

RewriteCond %{REMOTE_ADDR} ^203\.71\.84\.102$
RewriteRule ^/(.*)$ http://www.google.com.tw [R,L]
#如果從 203.71.84.102連過來的IP 則往 http://www.google.com 導
#[L]表示符合則停止,不在比對下去

RewriteRule ^/line\.gif$ /line.gif [PT]

</IfModule>

文章標籤
全站熱搜
創作者介紹
創作者 slinbody 的頭像
slinbody

495884965

slinbody 發表在 痞客邦 留言(0) 人氣(284)