명

Modify HTTP Headers (Examples)

· 2011-11-09 (수) 12:31:13 · 3183 · 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 조회 3,939
12-08-07 조회 3,610
12-08-03 조회 3,511
12-07-31 조회 3,619
12-07-30 조회 3,579
12-07-16 조회 3,791
12-07-15 조회 3,507
12-07-07 조회 3,492
12-07-06 조회 3,625
12-07-03 조회 3,637
12-06-29 조회 3,231
12-06-22 조회 3,593
12-06-17 조회 3,724
12-05-21 조회 3,779
12-05-02 조회 3,359
12-05-02 조회 4,154
12-05-02 조회 3,266
12-04-30 조회 3,440
12-04-30 조회 3,133
12-03-17 조회 3,973
12-03-10 조회 3,342
12-03-08 조회 3,776
12-03-03 조회 3,524
12-02-27 조회 4,937
12-02-17 조회 4,284
12-02-16 조회 4,461
12-02-03 조회 3,264
12-01-31 조회 3,034
12-01-24 조회 3,079
12-01-17 조회 3,834
12-01-05 조회 3,389
11-12-30 조회 3,019
11-12-23 조회 4,640
11-12-08 조회 3,378
11-12-07 조회 4,355
11-11-27 조회 3,773
11-11-25 조회 4,124
11-11-23 조회 3,516
11-11-22 조회 3,452
11-11-09 조회 3,184
11-10-23 조회 3,086
11-10-19 조회 3,060
11-10-08 조회 2,763
11-10-04 조회 2,776
11-10-04 조회 5,220
11-09-01 조회 4,278
11-08-13 조회 2,451
11-08-06 조회 3,143
11-07-11 조회 3,542
11-06-27 조회 2,910
11-06-21 조회 2,560
11-06-13 조회 2,360
11-06-07 조회 2,378
11-05-26 조회 2,370
11-04-20 조회 2,680
11-03-21 조회 2,769
11-03-18 조회 2,465
11-03-11 조회 2,503
11-02-07 조회 2,326
11-01-18 조회 2,640
11-01-12 조회 2,363
11-01-06 조회 2,484
10-12-10 조회 2,744
10-12-09 조회 2,415
10-12-08 조회 4,996
10-11-29 조회 2,547
10-11-28 조회 2,749
10-11-28 조회 2,592
10-11-19 조회 2,785
10-11-04 조회 2,678
10-10-21 조회 2,388
10-10-19 조회 3,339
10-10-12 조회 2,660
10-10-07 조회 2,492
10-09-30 조회 3,447
10-09-17 조회 3,844
10-09-17 조회 3,811
10-05-31 조회 3,475
09-12-31 조회 3,626
09-07-23 조회 4,937
08-09-16 조회 3,176
08-09-06 조회 2,896
08-09-04 조회 3,332
08-08-16 조회 4,383
08-08-15 조회 3,252
08-08-14 조회 4,463
08-08-12 조회 3,832
08-07-23 조회 2,751
08-07-10 조회 3,692
08-07-04 조회 2,917
08-06-27 조회 7,571
08-06-19 조회 4,857
08-05-27 조회 5,472
08-05-25 조회 5,298
08-05-23 조회 3,372
08-05-23 조회 4,509
08-05-21 조회 4,893
08-05-20 조회 4,016
08-05-20 조회 3,252
08-04-18 조회 4,287