리눅스

htaccess RewriteRule Redirection 리다이렉션 짧은주소 Short url address

조원태 2015. 10. 24. 23:41
반응형

.htaccess를 이용하면 아파치 환견설정파일인 httpd.conf에서 구현 할 수 있는 것을 구현할 수 있습니다.

Using .htaccess, you can implement that can be implemented in the Apache configuration file httpd.conf.

 

가령 짧은 주소를 만들거나 리다이렉트 시키는 기능입니다.

For example, the ability to create or redirect the short address.

 

.htaccess는  숨은 파일이여서 ls 명령어로는 보이지 않아요.

 I can not see the .htaccess file is a hidden yiyeoseo ls command.

 

 

$ ls -all

 

위와 같이 명령어를 리눅스 쉘에 입력하면 .htaccess를 확인 가능해요.

When you enter commands on a Linux shell as above, you can confirm the .htaccess.

 

ftp에서 보시면 그냥 파일이 보일 거에요.

If you look at the ftp you'll just see the files.

 

쉘을 못 다루시는 분은 ftp나 웹에디터를 사용하세요. 

When dealing with a shell not a minute Please use ftp or a web editor.

 

 

Examples )

RewriteEngine On

RewriteBase /

 

RewriteRule sample.php /sample2.php [L]

RewriteRule boardview/(.*) /bbs/board.php?bo_table=dev_board&wr_id=$1 [L]

 

 

위와 같이 이렇게 3줄이면 구현 가능해요

As above so it can implement 3 Decreasing

 

예전에 저도 이것에 대해 잘 모를 때 엄청 고생하면서 찾았어요

In the past I've found tremendous suffering while you are unsure about this,

 

RewriteEngine On   <=== 모듈을 사용하겠다.  I will use the module.

RewriteBase /  <==== .htaccess가 있는 위치  where the .htaccess

RewriteRule   <===== Rule을 적어 주면 됩니다  The Rule will give a note

 

RewriteRule  (브라우저에 입력된 URL Input to the browser URL) (서버에 있는 파일 Files on the server) [L]

 

끝 End

 

Examples​ ) 

 

http://127.0.0.1/sample.php  ===> sample2.php 

 

sample2.php로 리다이렉트를 시키는 것이에요.

 It's that redirects to sample2.php.

 

 

RewriteRule boardview/(.*) /bbs/board.php?bo_table=dev_board&wr_id=$1 

여기서 (.*) 부분은 이 부분에 들어온 값을 $1에 보내겠다는 것이에요.

The (*) It's part of getdaneun send the value entered in this part of the $ 1. 

 

문서만 봐서 모르는 분들을 아래 동영상을 보고 따라 하시면 간단하게 구현 할 수 있을 것이에요

If you only looking at the video below to see along the document simply I do not know who's to be able to implement 

  

반응형