명

Modify HTTP Headers (Examples)

· 2011-11-09 (수) 12:31:13 · 3173 · 7
인터넷으로 찾을려면 귀찮은거.. 요기에다 남겨둡니다.

// See related links for more status codes
 
// Use this header instruction to fix 404 headers
// produced by url rewriting...
header('HTTP/1.1 200 OK');
 
// Page was not found:
header('HTTP/1.1 404 Not Found');
 
// Access forbidden:
header('HTTP/1.1 403 Forbidden');
 
// The page moved permanently should be used for
// all redrictions, because search engines know
// what's going on and can easily update their urls.
header('HTTP/1.1 301 Moved Permanently');
 
// Server error
header('HTTP/1.1 500 Internal Server Error');
 
// Redirect to a new location:
header('Location: http://www.example.org/');
 
// Redriect with a delay:
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';
 
// you can also use the HTML syntax:
// <meta http-equiv="refresh" content="10;http://www.example.org/ />
 
// override X-Powered-By value
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');
 
// content language (en = English)
header('Content-language: en');
 
// last modified (good for caching)
$time = time() - 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');
 
// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');
 
// set content length (good for caching):
header('Content-Length: 1234');
 
// Headers for an download:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"'); 
header('Content-Transfer-Encoding: binary');
// load the file to send:
readfile('example.zip');
 
// Disable caching of the current document:
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');



header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Pragma: no-cache');
 
// set content type:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain'); // plain text file
header('Content-Type: image/jpeg'); // JPG picture
header('Content-Type: application/zip'); // ZIP file
header('Content-Type: application/pdf'); // PDF file
header('Content-Type: audio/mpeg'); // Audio MPEG (MP3,...) file
header('Content-Type: application/x-shockwave-flash'); // Flash animation
 
// show sign in box
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';
|

댓글 7개

2011-11-09 (수) 12:32:39
download 하는 부분과, no-cache, Last-Modified 는 찾을때마다 귀찮아서..
감사 합니다. ㅎㅎ
추천
2011-11-10 (목) 11:40:59
감사감사...
2011-11-10 (목) 12:51:04
ㅊㅊ요
하얀건 배색이고 검은건 글자고
유용합니다.감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
12-01-22 조회 3,481
12-01-21 조회 2,792
12-01-19 조회 4,808
12-01-18 조회 2,765
12-01-18 조회 2,784
12-01-18 조회 2,990
12-01-17 조회 2,759
12-01-17 조회 2,979
12-01-14 조회 1.1만
12-01-14 조회 3,535
12-01-14 조회 3,847
12-01-11 조회 3,201
12-01-11 조회 3,068
12-01-11 조회 3,015
12-01-11 조회 3,052
12-01-11 조회 3,399
12-01-11 조회 2,604
12-01-10 조회 3,014
12-01-10 조회 2,799
12-01-10 조회 2,802
12-01-09 조회 2,748
12-01-08 조회 2,794
12-01-07 조회 2,777
12-01-06 조회 2,637
12-01-06 조회 2,758
12-01-05 조회 2,760
12-01-02 조회 2,910
11-12-29 조회 2,766
11-12-28 조회 2,771
11-12-28 조회 2,751
11-12-27 조회 2,988
11-12-23 조회 2,700
11-12-23 조회 2,745
11-12-21 조회 3,861
11-12-21 조회 2,853
11-12-19 조회 2,799
11-12-14 조회 4,121
11-12-08 조회 3,192
11-12-08 조회 4,029
11-12-07 조회 4,321
11-12-06 조회 4,223
11-12-06 조회 3,534
11-12-05 조회 3,169
11-12-05 조회 4,799
11-12-04 조회 3,134
11-12-03 조회 3,500
11-12-02 조회 3,359
11-12-02 조회 3,445
11-12-02 조회 2,780
11-12-01 조회 2,748
11-12-01 조회 3,651
11-12-01 조회 2,737
11-11-29 조회 5,624
11-11-23 조회 3,561
11-11-23 조회 3,866
11-11-22 조회 3,878
11-11-22 조회 2,932
11-11-21 조회 3,485
11-11-21 조회 2,767
11-11-18 조회 3,864
11-11-18 조회 3,039
11-11-17 조회 2,932
11-11-17 조회 2,933
11-11-17 조회 4,496
11-11-11 조회 2,796
11-11-11 조회 2,797
11-11-11 조회 3,932
11-11-11 조회 4,624
11-11-08 조회 2,904
11-11-06 조회 3,347
11-11-06 조회 3,638
11-10-21 조회 2,450
11-10-21 조회 2,351
11-10-19 조회 2,401
11-10-19 조회 3,897
11-10-08 조회 2,456
11-10-06 조회 4,136
11-10-01 조회 2,437
11-09-30 조회 2,538
11-09-29 조회 2,540
11-09-26 조회 2,394
11-09-23 조회 2,394
11-09-23 조회 2,169
11-09-22 조회 2,755
11-09-09 조회 3,037
11-08-30 조회 3,923
11-08-23 조회 2,179
11-08-12 조회 2,355
11-08-04 조회 3,943
11-07-01 조회 2,914
11-06-09 조회 2,553
11-05-17 조회 2,615
11-05-07 조회 2,936
11-04-21 조회 2,600
11-04-12 조회 2,442
11-04-11 조회 3,565
11-02-11 조회 2,696
11-02-08 조회 2,109
11-01-11 조회 2,521
10-11-26 조회 3,860