차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판이전 판다음 판 | 이전 판 | ||
tech:php_redirect [2016/07/12 00:56] – 바깥 편집 127.0.0.1 | tech:php_redirect [2019/03/13 01:45] (현재) – [301 redirect] V_L | ||
---|---|---|---|
줄 2: | 줄 2: | ||
======PHP로 redirect하기 ====== | ======PHP로 redirect하기 ====== | ||
- | PHP로 redirect하기 위해 다음과 같이 할 수 있다. | + | |
+ | [[tech: | ||
<file php> | <file php> | ||
줄 11: | 줄 12: | ||
</ | </ | ||
- | exit()를 넣어줌으로써 다른 헤더가 redirect에 영향을 주는 것을 막을 수 있다고 한다. | + | exit()를 넣어줌으로써 |
- | + | ||
- | Reference: | + | |
- | http:// | + | |
+ | ====301 redirect==== | ||
+ | [[url redirect|301 Redirct]]는 다음과 같이 한다. | ||
+ | <file php> | ||
+ | <?php | ||
+ | | ||
+ | | ||
+ | ?> | ||
+ | </ | ||
+ | 상대경로도 가능 | ||
+ | <file php> | ||
+ | if(preg_match(" | ||
+ | |Windows CE|Nokia|webOS|Opera Mini|SonyEricsson|opera mobi | ||
+ | |Windows hone|IEMobile|POLARIS", | ||
+ | { | ||
+ | header(" | ||
+ | } | ||
+ | </ |