명

Modify HTTP Headers (Examples)

· 2011-11-09 (수) 12:31:13 · 3206 · 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-03-19 조회 3,492
12-03-16 조회 4,041
12-03-14 조회 3,919
12-03-13 조회 3,538
12-03-13 조회 4,405
12-03-12 조회 5,472
12-03-12 조회 1만
12-03-08 조회 6,030
12-03-06 조회 1.1만
12-03-06 조회 3,721
12-03-06 조회 6,254
12-03-02 조회 5,020
12-02-29 조회 3,591
12-02-27 조회 4,081
12-02-22 조회 3,642
12-02-20 조회 3,622
12-02-20 조회 6,724
12-02-01 조회 3,237
12-01-30 조회 8,767
12-01-29 조회 3,259
12-01-24 조회 3,560
12-01-21 조회 3,229
12-01-10 조회 3,704
11-12-26 조회 3,599
11-12-23 조회 5,019
11-12-23 조회 4,677
11-12-23 조회 4,293
11-12-23 조회 8,002
11-12-22 조회 3,723
11-12-17 조회 3,750
11-12-12 조회 3,167
11-12-08 조회 7,704
11-12-08 조회 3,556
11-12-07 조회 3,800
11-12-06 조회 5,552
11-12-02 조회 3,515
11-12-01 조회 3,125
11-11-30 조회 6,928
11-11-26 조회 3,863
11-11-24 조회 4,644
11-11-22 조회 3,017
11-11-22 조회 6,641
11-11-18 조회 5,058
11-11-16 조회 3,447
11-11-14 조회 3,465
11-11-12 조회 3,955
11-11-08 조회 3,283
11-11-06 조회 1만
11-11-06 조회 3,857
11-11-03 조회 5,549
11-11-02 조회 5,820
11-11-01 조회 9,330
11-10-19 조회 2,827
11-10-17 조회 2,623
11-10-10 조회 2,571
11-10-07 조회 3,362
11-10-06 조회 3,958
11-10-06 조회 2,508
11-10-02 조회 3,259
11-09-08 조회 4,266
11-09-08 조회 2,642
11-09-07 조회 2,630
11-09-02 조회 2,710
11-09-01 조회 3,653
11-08-28 조회 3,540
11-08-23 조회 3,389
11-08-22 조회 2,796
11-08-22 조회 2,392
11-08-13 조회 2,442
11-08-05 조회 2,893
11-08-03 조회 4,098
11-07-03 조회 2,587
11-06-15 조회 3,232
11-06-15 조회 3,057
11-05-15 조회 2,874
11-05-11 조회 5,593
11-04-12 조회 2,998
11-01-27 조회 3,830
11-01-26 조회 2,630
11-01-26 조회 4,474
11-01-18 조회 2,686
10-11-23 조회 2,925
10-10-24 조회 4,738
10-09-15 조회 4,427
10-09-07 조회 3,399
10-08-27 조회 4,085
10-08-20 조회 6,975
10-07-30 조회 5,651
10-06-30 조회 2,888
10-06-11 조회 4,648
10-06-11 조회 3,339
10-05-15 조회 4,178
10-05-10 조회 2,860
10-03-19 조회 5,423
10-03-05 조회 5,187
10-02-17 조회 5,597
09-11-21 조회 6,934
09-11-09 조회 4,004
09-11-04 조회 6,731
09-10-26 조회 3,859