Windows Server > URL Rewrite ¸¦ ÀÌ¿ëÇÑ ÂªÀº ÁÖ¼Ò »ç¿ëÇϱ⠵î·ÏÀÏ : 2017-06-30 14:02 Á¶È¸¼ö : 48,816¿ì¸®¿¡°Ô Àß ¾Ë·ÁÁø XpressEngine, Textyle, Textcube µî ¸¹Àº À¥ ¾îÇø®ÄÉÀ̼ǵéÀÌ Rewrite µ¿ÀÛ¿¡ ±â¹ÝÇÑ Fancy URL À» Á¦°øÇÏ°í ÀÖÀ¸¸ç IIS ¿¡¼µµ URL Rewrite ¸ðµâÀ» »ç¿ëÇÏ¿© ±¹³» ¿ÀǼҽº ¾îÇø®ÄÉÀ̼ǿ¡¼ Á¦°øÇÏ´Â Rewrite ±ÔÄ¢À» ±×´ë·Î ÀÌ¿ë °¡´ÉÇÕ´Ï´Ù.
À̹ø Æ÷½ºÆÿ¡¼´Â URL Rewrite ±â´É°ú °ü·ÃÇÏ¿© ¾Æ·¡ 3°¡Áö ±ÔÄ¢À» »ý¼ºÇÏ¿© Å×½ºÆ® ÇØ º¸µµ·Ï ÇÏ°Ú½À´Ï´Ù. URL Rewrite ±ÔÄ¢ »ý¼º URL Redirect ±ÔÄ¢ »ý¼º Access Block ±ÔÄ¢ »ý¼º 1. URL Rewrite ±ÔÄ¢ »ý¼º ù ¹ø°, URL Rewrite ±ÔÄ¢À» »ý¼ºÇÏ´Â ¹æ¹ýÀÔ´Ï´Ù. ¾Æ·¡ ¿¹Á¦¸¦ ÅëÇØ °£´ÜÈ÷ URL Rewrite ±ÔÄ¢À» »ý¼ºÇϵµ·Ï ÇÏ°Ú½À´Ï´Ù. [Fancy URL] http://localhost/article/555/some-article-title [Rewrite URL] http://localhost/article.php?id=555&title=some-article-title À§¿Í °°ÀÌ Fancy URL Àº »ç¶÷À̳ª °Ë»ö ¿£Áø¿¡´Â Ä£ÈÀûÀÌÁö¸¸ ¾îÇø®ÄÉÀ̼ÇÀ» ó¸®Çϱâ À§ÇÑ ¿äûÀ¸·Î´Â ÀûÇÕÇÏÁö ¾Ê±â ¶§¹®¿¡ ¾Æ·¡¿¡ ÀÖ´Â URL ¿Í °°ÀÌ URL Rewrite ¸¦ ÅëÇØ Rewrite ÇØ¾ß ÇÒ ÇÊ¿ä°¡ ÀÖ½À´Ï´Ù. 1. URL Rewrite ±ÔÄ¢ »ý¼º °¡. IIS °ü¸®ÀÚ¿¡¼ PHP Site ÀÇ ±â´É¿¡¼ URL Rewrite ½ÇÇà - Add Rule(s) ³ª. Inbound rules - Blank rule ¼±Åà ´Ù. Name, Pattern, Action À» Á¤ÀÇÇÏ°í ¿ìÃø 'ÀÛ¾÷' ¿µ¿ª¿¡¼ 'Àû¿ë' ¹öÆ°À» Ŭ¸¯Çϸé ÀúÀåµË´Ï´Ù. 1) Name : ±ÔÄ¢ÀÇ À̸§ 2) Pattern : ^article/([0-9]+)/([_0-9a-z-]+) °¡) ¹®ÀÚ¿ÀÇ ½ÃÀÛÀÌ "article/" ·Î ½ÃÀÛ ³ª) Çϳª ÀÌ»óÀÇ ¼ýÀÚ°¡ "/" µÚ¿¡ ³ªÅ¸³² ´Ù) Çϳª ÀÌ»óÀÇ "_", "-", ¾ËÆĺª ¹®ÀÚ¿ÀÌ µÎ ¹ø° "/" ÀÌÈÄ¿¡ Á¸ÀçÇÔ Áï, À§¿Í °°Àº ÆÐÅÏÀÌ È®ÀÎµÇ¸é ¾Æ·¡ Action Rewrite URL ±ÔÄ¢ÀÌ µ¿ÀÛÇÏ°Ô µË´Ï´Ù. 3) Action : article.php?id={R:1}&title={R:2} °¡) {R:0} : article/555/some-article-title ³ª) {R:1} : 555 ´Ù) {R:2} : some-article-title Áï, R:1 ¿¡ Rewrite µÈ ÆÐÅÏÀÇ Ã¹ ¹ø° °ª, R:2 ¿¡ µÎ ¹ø° °ªÀÌ ±ÔÄ¢¿¡ ÀÇÇØ ÇÒ´çµË´Ï´Ù. 1) Name : ±ÔÄ¢ÀÇ À̸§ 2) Pattern : ^article/([0-9]+)/([_0-9a-z-]+) °¡) ¹®ÀÚ¿ÀÇ ½ÃÀÛÀÌ "article/" ·Î ½ÃÀÛ ³ª) Çϳª ÀÌ»óÀÇ ¼ýÀÚ°¡ "/" µÚ¿¡ ³ªÅ¸³² ´Ù) Çϳª ÀÌ»óÀÇ "_", "-", ¾ËÆĺª ¹®ÀÚ¿ÀÌ µÎ ¹ø° "/" ÀÌÈÄ¿¡ Á¸ÀçÇÔ Áï, À§¿Í °°Àº ÆÐÅÏÀÌ È®ÀÎµÇ¸é ¾Æ·¡ Action Rewrite URL ±ÔÄ¢ÀÌ µ¿ÀÛÇÏ°Ô µË´Ï´Ù. 3) Action : article.php?id={R:1}&title={R:2} °¡) {R:0} : article/555/some-article-title ³ª) {R:1} : 555 ´Ù) {R:2} : some-article-title Áï, R:1 ¿¡ Rewrite µÈ ÆÐÅÏÀÇ Ã¹ ¹ø° °ª, R:2 ¿¡ µÎ ¹ø° °ªÀÌ ±ÔÄ¢¿¡ ÀÇÇØ ÇÒ´çµË´Ï´Ù. 2. ½ÇÇà °á°ú http://localhost/article/555/some-article-title URL ¿¡ Á¢¼ÓÇØ º¸¸é Fancy URL ÀÌ À§¿¡¼ »ý¼ºÇß´ø ±ÔÄ¢´ë·Î Rewrite ó¸® µÇ¾úÀ½À» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù. 2. URL Redirect [¿øº» URL] http://localhost/blog/some-other-title/777 [Redirect URL] http://localhost/article/777/some-other-title 2. URL Redirect [¿øº» URL] http://localhost/blog/some-other-title/777 [Redirect URL] http://localhost/article/777/some-other-title 1. Redirect ±ÔÄ¢ »ý¼º °¡. IIS °ü¸®ÀÚ¿¡¼ PHP Site ÀÇ ±â´É¿¡¼ URL Rewrite ½ÇÇà - Add Rule(s) - Inbound rules - Blank rule ¼±Åà ³ª. Name, Pattern, Action Type, Redirect URL, Redirect type 1) Name : Redirect from Blog 2) Pattern : ^blog/([_0-9a-z-]+)/([0-9]+) 3) Action type : Redirect 4) Redirect URL : article/{R:2}/{R:1} 5) Redirect type : Temporary (307) 1) Name : Redirect from Blog 2) Pattern : ^blog/([_0-9a-z-]+)/([0-9]+) 3) Action type : Redirect 4) Redirect URL : article/{R:2}/{R:1} 5) Redirect type : Temporary (307) 2. ½ÇÇà °á°ú ÀÎÅÍ³Ý ÀͽºÇ÷η¯ ½ÇÇà ÈÄ http://localhost/blog/some-other-title/777 URL À» ÀÔ·ÂÇϸé http://localhost/article/777/some-other-title URL ·Î Redirect µÊÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.
|