메뉴 건너뛰기

조회 수 7667 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄


List of methods used to redirect a web site using Apache:
Web site forwarding and redirection methods:
  1. One can forward a web page URL or home page using the following web page with the "Refresh" directive:
    <META HTTP-EQUIV="Refresh" Content="0; URL=http://www.company.com/dir1/">
    This commands the browser to refresh the page with the new specified URL. This forwards a single page only and not the entire domain. It can forward the default home page for the domain giving the appearance of forwarding the domain.. or:
    <html>
    <head>
    <META HTTP-EQUIV="Refresh" Content="3; URL=http://www.company.com/dir1/">
    </head>
    <body>
    This page will forward to http://www.company.com/dir1/ in three seconds.
    <p>
    Please update your links.
    </body>
    </html>

  2. Use a CGI script to forward a home page: (mod_cgi)
    File: httpd.conf
    ScriptAlias / /var/www/cgi-bin/redirect-script/
    File: /var/www/cgi-bin/redirect-script
    #!/usr/bin/perl
    
    print "Status: 301 Moved\r\n" .
          "Location: http://www.new-domain.com/\r\n" .
          "\r\n";
                        
    or:
    #!/usr/bin/perl -w
    use strict;
    use CGI qw/:standard/;
    print redirect('http://www.new-domain.com');
                        

  3. Use a PHP script to redirect:
    <?php
    header("Location: http://www.new-domain.com/");
    ?>
                        
  4. Use a Javascript to redirect:
    <html>
    <head>
    <script language="Javascript" type="text/javascript">
    <!-- Hide script
    //<![CDATA[
    window.location.href="http://www.new-domain.com/"	    
    //]]> End script hiding -->
    </script>
    </head>
    </html>
                        
  5. Use Apache module (mod_rewrite)
    File: httpd.conf
    RewriteEngine On
    RewriteRule /.* http://www.new-domain.com/ [R]
    Forwards all references in entire domain.

  6. Use Apache module (mod_alias )
    File: httpd.conf
    • Redirect Domain:
      Redirect / http://www.new-domain.com/
      or
      Redirect permanent / http://www.new-domain.com/
    • Redirect Page:
      Redirect /web-page.html http://www.new-domain.com/destination-web-page.html
                              
    Note:
    • Redirect directives take precedence over Alias and ScriptAlias directives.
    • Other "Redirect" options include: temp (error 302) default - temporary redirect status, seeother (error 303) resource has been replaced and gone (error 410) resource has been permanently removed.
    Example httpd.conf with virtual hosts for multiple domains which all redirect:
    <VirtualHost XXX.XXX.XXX.XXX>
    ServerName directtolinux.com
    ServerAlias www.directtolinux.com
    ServerAlias direct-to-linux.com
    ServerAlias www.direct-to-linux.com
    ServerAlias digitalpenguins.com
    ServerAlias www.digitalpenguins.com
    Redirect permanent / http://www.yolinux.com/
    </VirtualHost>
                            


  7. Apache 301 redirect using the .htaccess file:
    If one wants to permanently forward an entire web site to a new URL or forward a single page permanently and have the search engines update their database, one should use a 301 redirect. This may redirect to a new server or to itself but to a different domain. This tutorial shows how. This method is a variation of using the mod_alias redirection shown above except that it allows the customer to redirect themselves by providing a .htaccess file themselves.
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yolinux.com
    RewriteRule ^(.*)$ http://www.yolinux.com/$1 [R=permanent,L]
    This example forwards http://yolinux.com to http://www.yolinux.com/ to unify your site to a single URL. This can also simplify your web logs if they can not distinguish between the two


  1. No Image

    확장자가 없는 파일 자동인식하는 mod_mime_magic

    Date2016.03.18 Views9316
    Read More
  2. No Image

    하루동안 실행된 쿼리 중 수행시간이 가장 긴 조회 쿼리 100개

    Date2017.04.28 Views8042
    Read More
  3. No Image

    하드디스크의 속도와 성능테스트강좌 hdparm

    Date2014.02.27 Views7471
    Read More
  4. No Image

    하드디스크 배드블록 점검 툴 - badblocks

    Date2016.03.18 Views8808
    Read More
  5. No Image

    포그라운드, 백그라운드, nohup 정리

    Date2017.04.18 Views9052
    Read More
  6. No Image

    파일 속성 명령어 : chattr, lsattr

    Date2014.02.27 Views9622
    Read More
  7. No Image

    특정 웹페이지에서 문자가 깨지는 경우 (인코딩 문제)

    Date2016.03.18 Views7553
    Read More
  8. No Image

    특정 데몬의 메모리 점유율 확인하기

    Date2014.02.27 Views8051
    Read More
  9. No Image

    컴파일을 이용하여 Apache 최신버전을 설치하자

    Date2016.03.18 Views7632
    Read More
  10. No Image

    재지향시 유의사항 (grep 재지향)

    Date2021.03.26 Views185
    Read More
  11. 작업 예약 스케줄러(크론Cron)파일,자동 백업 명령

    Date2023.01.12 Views133
    Read More
  12. 인코딩 깨진한글파일 삭제 방법

    Date2016.07.22 Views8957
    Read More
  13. No Image

    이온큐브로더(ioncube) 설치 매뉴얼

    Date2016.03.18 Views10391
    Read More
  14. No Image

    이미지 및 파일 무단링크 방지책

    Date2019.02.14 Views1137
    Read More
  15. 웹호스팅용 리눅스 서버 셋팅

    Date2014.02.27 Views7735
    Read More
  16. 웹호스팅용 리눅스 서버 셋팅

    Date2014.03.26 Views7940
    Read More
  17. No Image

    웹서버(Nginx+FastCGI PHP)구축 및 성능 시험

    Date2017.09.20 Views5530
    Read More
  18. No Image

    웹서버 모니터링 툴 awststs

    Date2014.03.26 Views10277
    Read More
  19. No Image

    웹로직 서버 시작 및 종료 스크립트

    Date2017.04.28 Views8466
    Read More
  20. No Image

    웹로직 + 아파치 연동

    Date2017.04.13 Views8685
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 12 Next
/ 12

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved