명

Modify HTTP Headers (Examples)

· 2011-11-09 (수) 12:31:13 · 3182 · 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-08-29 조회 5,469
12-08-21 조회 3,460
12-08-21 조회 3,543
12-08-05 조회 3,371
12-08-04 조회 4,379
12-07-31 조회 9,264
12-07-26 조회 3,865
12-07-24 조회 3,501
12-07-20 조회 3,481
12-07-15 조회 3,325
12-07-09 조회 4,674
12-07-09 조회 3,386
12-07-09 조회 3,295
12-07-06 조회 4,115
12-07-05 조회 3,216
12-07-05 조회 3,289
12-06-30 조회 3,417
12-06-29 조회 3,210
12-06-26 조회 3,426
12-06-18 조회 3,301
12-06-18 조회 3,425
12-05-31 조회 3,601
12-05-29 조회 4,361
12-05-23 조회 3,426
12-05-22 조회 3,705
12-05-17 조회 4,466
12-05-10 조회 3,481
12-05-06 조회 3,351
12-05-04 조회 3,035
12-04-25 조회 3,509
12-04-21 조회 3,050
12-04-21 조회 4,444
12-04-20 조회 3,549
12-04-10 조회 2,964
12-04-06 조회 2,838
12-04-05 조회 3,180
12-04-05 조회 3,854
12-03-31 조회 3,009
12-03-30 조회 3,072
12-03-29 조회 2,988
12-03-28 조회 3,008
12-03-27 조회 3,320
12-03-26 조회 3,713
12-03-23 조회 2,908
12-03-20 조회 2,960
12-03-12 조회 2,894
12-03-12 조회 3,236
12-03-12 조회 3,149
12-03-12 조회 4,101
12-03-12 조회 5,665
12-03-12 조회 3,692
12-03-12 조회 5,500
12-03-12 조회 3,711
12-03-12 조회 6,095
12-03-06 조회 3,023
12-03-04 조회 4,154
12-03-02 조회 4,064
12-02-16 조회 5,139
12-02-15 조회 4,511
12-02-11 조회 2,981
12-02-08 조회 2,831
12-02-08 조회 3,847
12-02-07 조회 3,249
12-01-30 조회 2,949
12-01-29 조회 3,365
12-01-25 조회 3,361
12-01-19 조회 2,920
12-01-12 조회 3,046
11-12-30 조회 3,676
11-12-29 조회 3,069
11-12-26 조회 3,057
11-12-26 조회 2,951
11-12-17 조회 4,098
11-12-17 조회 3,286
11-12-01 조회 3,048
11-11-19 조회 4,228
11-11-14 조회 4,107
11-11-14 조회 2,730
11-11-10 조회 2,966
11-11-10 조회 3,630
11-10-27 조회 2,500
11-10-26 조회 2,590
11-10-25 조회 2,501
11-10-17 조회 3,659
11-10-10 조회 2,538
11-10-03 조회 2,595
11-09-28 조회 2,476
11-09-28 조회 3,976
11-09-26 조회 2,458
11-09-26 조회 2,572
11-09-25 조회 2,910
11-09-19 조회 6,020
11-09-09 조회 2,957
11-09-08 조회 3,307
11-08-31 조회 3,106
11-08-29 조회 5,093
11-08-25 조회 2,772
11-08-23 조회 2,453
11-08-21 조회 2,465
11-08-19 조회 2,388