Q&A

문의하신 부분에 대해서는 아래 url을 참고하여 적용해 보시기 바랍니다.
http://tuwlab.com/ece/11228


이미지링크 차단하는 부분에 대해 서버상에서 설정하는 방법은 없습니다.
그러므로 위 url의 방법외에 다른 방법이나 좀더 자세한 내용이 필요하신 경우에는 네이버나 구글 등에서 관련 내용을 검색하여 참고해 주시기 바랍니다.

 

카페24 사용중인데 질문을 하니 위와같이 답변을 하고,

이렇게 해도 안되던데 방법이 없을까요? (물론 여기서 검색해봤습니다. 다 안되더라구요.)

 

아래는 www디렉토리 안에 .htaccess 그리고 .htaccess_bk 입니다. 

 

 

RewriteEngine On

# reserve XE Layout Template Source File (*.html)
RewriteRule ^(layouts|m.layouts)/(.+)\.html$ - [L,F]
# reserve XE Template Source Files (*.html)
RewriteCond %{REQUEST_URI} !/modules/editor/
RewriteRule /(skins|m.skins)/(.+)\.html$ - [L,F]

# conf, query, schema
RewriteRule ^(modules|addons|widgets)/(.+)/(conf|queries|schemas)/(.+)\.xml$ ./index.php [L]

# static files
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.+)/files/(member_extra_info|attach|cache|faceOff)/(.*) ./files/$2/$3 [L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.+)/(files|modules|widgets|widgetstyles|layouts|m.layouts|addons)/(.*) ./$2/$3 [L]

# rss , blogAPI
RewriteRule ^(rss|atom)$ ./index.php?module=rss&act=$1 [L]
RewriteRule ^([a-zA-Z0-9_]+)/(rss|atom|api)$ ./index.php?mid=$1&act=$2 [L]
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/(rss|atom|api)$ ./index.php?vid=$1&mid=$2&act=$3 [L]

# trackback
RewriteRule ^([0-9]+)/(.+)/trackback$ ./index.php?document_srl=$1&key=$2&act=trackback [L]
RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?mid=$1&document_srl=$2&key=$3&act=trackback [L]
RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?vid=$1&document_srl=$2&key=$3&act=trackback [L]
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?vid=$1&mid=$2&document_srl=$3&key=$4&act=trackback [L]

# document permanent link
RewriteRule ^([0-9]+)$ ./index.php?document_srl=$1 [L,QSA]

# mid link
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_]+)/?$ ./index.php?mid=$1 [L,QSA]
# mid + document link
RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)$ ./index.php?mid=$1&document_srl=$2 [L,QSA]

# vid + mid link
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/?$ ./index.php?vid=$1&mid=$2 [L,QSA]
# vid + mid + document link
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)$ ./index.php?vid=$1&mid=$2&document_srl=$3 [L,QSA]

# mid + entry title
RewriteRule ^([a-zA-Z0-9_]+)/entry/(.+)$ ./index.php?mid=$1&entry=$2 [L,QSA]
# vid + mid + entry title
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/entry/(.+)$ ./index.php?vid=$1&mid=$2&entry=$3 [L,QSA]

#shop / vid / [category|product] / identifier
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_\.-]+)$ ./index.php?act=route&vid=$1&type=$2&identifier=$3 [L,QSA]

# sitemap
RewriteRule ^sitemap([0-9]*)\.xml$ ./index.php?module=sitemap&act=sitemap&page=$1 [L]

 

 

 

RewriteEngine On

# reserve XE Layout Template Source File (*.html)
RewriteRule ^(layouts|m.layouts)/(.+)\.html$ - [L,F]
# reserve XE Template Source Files (*.html)
RewriteCond %{REQUEST_URI} !/modules/editor/
RewriteRule /(skins|m.skins)/(.+)\.html$ - [L,F]

# conf, query, schema
RewriteRule ^(modules|addons|widgets)/(.+)/(conf|queries|schemas)/(.+)\.xml$ ./index.php [L]

# static files
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.+)/files/(member_extra_info|attach|cache|faceOff)/(.*) ./files/$2/$3 [L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.+)/(files|modules|widgets|widgetstyles|layouts|m.layouts|addons)/(.*) ./$2/$3 [L]

# rss , blogAPI
RewriteRule ^(rss|atom)$ ./index.php?module=rss&act=$1 [L]
RewriteRule ^([a-zA-Z0-9_]+)/(rss|atom|api)$ ./index.php?mid=$1&act=$2 [L]
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/(rss|atom|api)$ ./index.php?vid=$1&mid=$2&act=$3 [L]

# trackback
RewriteRule ^([0-9]+)/(.+)/trackback$ ./index.php?document_srl=$1&key=$2&act=trackback [L]
RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?mid=$1&document_srl=$2&key=$3&act=trackback [L]
RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?vid=$1&document_srl=$2&key=$3&act=trackback [L]
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?vid=$1&mid=$2&document_srl=$3&key=$4&act=trackback [L]

# document permanent link
RewriteRule ^([0-9]+)$ ./index.php?document_srl=$1 [L,QSA]

# mid link
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_]+)/?$ ./index.php?mid=$1 [L,QSA]
# mid + document link
RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)$ ./index.php?mid=$1&document_srl=$2 [L,QSA]

# vid + mid link
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/?$ ./index.php?vid=$1&mid=$2 [L,QSA]
# vid + mid + document link
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)$ ./index.php?vid=$1&mid=$2&document_srl=$3 [L,QSA]

# mid + entry title
RewriteRule ^([a-zA-Z0-9_]+)/entry/(.+)$ ./index.php?mid=$1&entry=$2 [L,QSA]
# vid + mid + entry title
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/entry/(.+)$ ./index.php?vid=$1&mid=$2&entry=$3 [L,QSA]

#shop / vid / [category|product] / identifier
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_\.-]+)$ ./index.php?act=route&vid=$1&type=$2&identifier=$3 [L,QSA]

 

 

 

댓글 7

  • 어떻게 해보셨고 무엇이 안되나요?

    지금 올려주신 .htaccess 파일에는 이미지 불펌방지 코드가 전혀 안 보이는데요.

    링크하신 주소에서 알려주시는 내용을 맨 아래에 추가해 보세요.

     

    단, XE타운처럼 SSL을 사용하는 사이트에서 링크하는 것은 막을 수 없습니다.

  • @기진곰

    아아 저것은 해봐도 안되길래 그냥 뺀 최초의 것을 올린것입니다.

    그럼 아래와 같이 하면 되나요?

     

    RewriteEngine On
     
    # reserve XE Layout Template Source File (*.html)
    RewriteRule ^(layouts|m.layouts)/(.+)\.html$ - [L,F]
    # reserve XE Template Source Files (*.html)
    RewriteCond %{REQUEST_URI} !/modules/editor/
    RewriteRule /(skins|m.skins)/(.+)\.html$ - [L,F]
     
    # conf, query, schema
    RewriteRule ^(modules|addons|widgets)/(.+)/(conf|queries|schemas)/(.+)\.xml$ ./index.php [L]
     
    # static files
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule ^(.+)/files/(member_extra_info|attach|cache|faceOff)/(.*) ./files/$2/$3 [L]
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule ^(.+)/(files|modules|widgets|widgetstyles|layouts|m.layouts|addons)/(.*) ./$2/$3 [L]
     
    # rss , blogAPI
    RewriteRule ^(rss|atom)$ ./index.php?module=rss&act=$1 [L]
    RewriteRule ^([a-zA-Z0-9_]+)/(rss|atom|api)$ ./index.php?mid=$1&act=$2 [L]
    RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/(rss|atom|api)$ ./index.php?vid=$1&mid=$2&act=$3 [L]
     
    # trackback
    RewriteRule ^([0-9]+)/(.+)/trackback$ ./index.php?document_srl=$1&key=$2&act=trackback [L]
    RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?mid=$1&document_srl=$2&key=$3&act=trackback [L]
    RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?vid=$1&document_srl=$2&key=$3&act=trackback [L]
    RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)/(.+)/trackback$ ./index.php?vid=$1&mid=$2&document_srl=$3&key=$4&act=trackback [L]
     
    # document permanent link
    RewriteRule ^([0-9]+)$ ./index.php?document_srl=$1 [L,QSA]
     
    # mid link
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^([a-zA-Z0-9_]+)/?$ ./index.php?mid=$1 [L,QSA]
    # mid + document link
    RewriteRule ^([a-zA-Z0-9_]+)/([0-9]+)$ ./index.php?mid=$1&document_srl=$2 [L,QSA]
     
    # vid + mid link
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/?$ ./index.php?vid=$1&mid=$2 [L,QSA]
    # vid + mid + document link
    RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([0-9]+)$ ./index.php?vid=$1&mid=$2&document_srl=$3 [L,QSA]
     
    # mid + entry title
    RewriteRule ^([a-zA-Z0-9_]+)/entry/(.+)$ ./index.php?mid=$1&entry=$2 [L,QSA]
    # vid + mid + entry title
    RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/entry/(.+)$ ./index.php?vid=$1&mid=$2&entry=$3 [L,QSA]
     
    #shop / vid / [category|product] / identifier
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_\.-]+)$ ./index.php?act=route&vid=$1&type=$2&identifier=$3 [L,QSA]
     
    # sitemap
    RewriteRule ^sitemap([0-9]*)\.xml$ ./index.php?module=sitemap&act=sitemap&page=$1 [L]

    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?(www를 제외한 사이트 주소) [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?naver.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?nate.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?daum.net [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?paran.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.co.kr [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.co.com [NC]
    RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ - [NC,F,L]

    이게 맞는건가요?

     

    그리고  .htaccess_bk 파일도 수정해줘야 하나요?

     

  • @파란나라

    네, www를 제외한 사이트 주소를 정확하게 넣어 주시고요.

    .htaccess_bk는 예전에 백업해두신 것 같은데, 수정하지 않으셔도 됩니다.

    그래도 안 된다면 어딘가 다른 문제가 있을 것 같네요.

  • @기진곰

    기진곰님 한가지만 더 여쭤봐도 될까요?

    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.co.com [NC]

    여기에서 google.co.com 이 아니고 google.com 이 맞는거같은데.. 어떻게 생각하시는지요?

    google.co.com [NC] 이라고 되있어서요

  • @파란나라
    네, google.com이 옳지요. 글쓴이가 google.co.kr을 복붙하다가 실수한 것 같아요.
  • 위 방법은 안되고 다른 방법으로 잘 해결했네요

  • @파란나라
    다른 방법으로 해결하신 걸 남겨주시면 다른 분들이 참고하기에 좋을 것 같네요.