Redirect 重導網頁
作者: cross 日期: 2006-11-05 21:41
php 方式 - 2008/01/23
除了使用 index.html 的方式,可在 apache 的 conf 檔裡動手腳 - 2007/12/28
vi /etc/httpd/conf/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
<VirtualHost *:80>
ServerAdmin cross@ssorc.tw
ServerName proxy.ssorc.tw
ErrorLog logs/proxy.ssorc.tw-error_log
CustomLog logs/proxy.ssorc.tw-access_log combined
CustomLog logs/proxy.ssorc.tw-deflate_log deflate
ProxyRequests Off
ProxyPass / http://1.1.1.1:123
ProxyPassReverse / http://1.1.1.1:123
</VirtualHost>
如此當連 proxy.ssorc.tw 就會導到 http://1.1.1.1:123
把某些檔案重導至某個地方 - 2007/11/02
在 .htaccess 只要兩行就可以了
Quote: http://www.j2h.tw/bbs/bbs16/30.html
現在越來越多人採用自己架設主機的方式放置網頁,也因ADSL的價格逐漸下滑,但有無發覺..日子久了,怎網頁開啟速度越來越慢??線上也沒多少人啊..其實有可能是有其他網站連結您主機內的圖檔,分享了您的頻寬了!!增加主機頻寬負荷
因此設定 Apache mod_rewrite 來防止mod_rewrite on一. 開啟 .htaccess 權限
1. 開啟 httpd.conf
2. 搜尋 AllowOverride None,或是只搜尋 AllowOverride 關鍵字
3. 把 None 改成 ALL,表示完全接受 .htaccess 裏的所有權限設定,然後存檔增加以下內容的 .htaccess 檔,放在網站目錄下即可。
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://lym.fyman.idv.tw(.*) [NC]
RewriteRule .(jpg|jpeg|gif|css|swf|png|bmp|rar|zip|exe)$ - [F]第一行為開啟 RewriteEngine,二三行設定允許的連線
第四行則是從其他地方連進來且是那些檔名的,看到403錯誤訊息,也可以改成顯示指定的圖片。
或是在網站目錄下的 .htaccess 檔中、或 httpd.conf 檔中加入下列內容即可:程式碼
<FilesMatch ".(jpg|jpeg|gif|png|zip|exe|swf)$">
SetEnvIfNoCase Referer "^http://yourdomain.com/" local_referrer=1
Order Allow,Deny
Allow from env=local_referrer
</FilesMatch>記得把 http://yourdomain.com/ 這一段改成自己的網站 URL
利用 RewriteRule 達成縮減網址的功能,
不過在此處使用此功能做為切割主機的作用,
將符合前三個規則的網頁,指向本機的檔案
剩下的都去找另外一台主機
[L] : 到此為止
[P] : 保留網址
[R] : 強制導向httpd.conf
RewriteEngine on
RewriteRule ^([^/]+)(html|htm|css|js|php)$ - [L]
RewriteRule ^(forum|images|flash|admin)(.*)$ - [L]
RewriteRule ^$ - [L]
RewriteRule ^(.*)$ http://www0.nttu.edu.tw/$1 [R,L,P]
index.html
方式一
<html><head>
<meta http-equiv="Refresh" content="0;URL=http://your_server/cgi-bin/openwebmail/openwebmail.pl">
</head></html>
方式二
<html>
<body onload="window.open('http://your_server/cgi-bin/openwebmail/openwebmail.pl','_top')">
</body>
</html>
顯示Tag關聯文章
上一篇
返回
下一篇


