ÀÛ¼ºÀÏ : 2002.03.01 ÀÛ¼ºÀÚ : »êÀÌ ¹®¼­ URL : http://www.linuxchannel.net/docs/apache-allowoverride.txt *ÁÖ) ¹®¸Æ»ó °£È¤ °æ¾î¸¦ »ý·«Çß½À´Ï´Ù. ¾çÇØÇØ ÁÖ½Ã±æ ¹Ù¶ø´Ï´Ù. [¾ÆÆÄÄ¡] AllowOverride¿Í .htaccess ÀϹÝÀûÀ¸·Î °Ô½ÃÆÇÀ̳ª ±âŸ BBS¿¡ ÆÄÀÏÀ» ÷ºÎÇÒ °æ¿ì ÀûÁö ¾Ê°Ô text/html Çü½ÄÀÇ *.html *.htm ÆÄÀÏÀÌ ¸¹ÀÌ ¿Ã¶ó¿À°ï ÇÕ´Ï´Ù. º¸¾ÈÀÇ ÀÌÀ¯·Î ¿Ã¶ó¿Â text/html ÆÄÀÏÀ» °­Á¦·Î .phps³ª .txt ·Î ¸¶ÀÓŸÀÔÀ» ¹Ù²Ù´Â °æ¿ì°¡ ¸¹À¸³ª ¿Ã¶ó¿Â text/html ÆÄÀÏ¿¡ phpÄڵ尡 ¾Èµé¾î°£ ¼ø¼ö HTMLÄڵ常 ÀÖÀ» °æ¿ì ÀÏ¹Ý »ç¿ëÀÚ°¡ º¸±â¿£ »ó´çÈ÷ ºÒÇÕ¸®ÇÏ´Ù. ±×·¡¼­ ¾÷·Îµå µð·ºÅ丮¿¡ ÇÑ¿¡¼­ *.html *.htmÆÄÀÏÀ» phpÄڵ尡 ½ÇÇàµÇÁö ¾Êµµ·Ï ¸¶ÀÓŸÀÔÀ» ÀçÁ¶Á¤ÇØ¾ß ÇÕ´Ï´Ù. ¿ì¼± À§ÀÇ ¹®Á¦¸¦ ÇØ°áÇϱâ À§Çؼ­´Â ¾ÆÆÄÄ¡ httpd.conf ÆÄÀÏ¿¡¼­ ´ÙÀ½°ú °°Àº Á¶°ÇÀÌ ¿ì¼± ÇØ°áµÇ¾î ÀÖ¾î¾ß ÇÑ´Ù. Áï, ¾ÆÆÄÄ¡ server config¿¡¼­ ÃÖ¼ÒÇÑ »ç¿ëÀÚ °èÁ¤ µð·ºÅ丮³ª ƯÁ¤ µð·ºÅ丮¿¡ access control ÆÄÀÏ (ÀÌÇÏ '.htaccess')À» »ç¿ëÇÒ ¼ö ÀÖµµ·Ï AllowOverride¿¡ ÃÖ¼ÒÇÑ FileInfo ±â´ÉÀ» Æ÷ÇÔÇÏ°í ÀÖ¾î¾ß ÇÑ´Ù. ÀÌ´Â .htaccessÆÄÀÏÀ» ÀÌ¿ëÇؼ­ AddtypeÁö½ÃÀÚ¸¦ »ç¿ëÇϱâ À§ÇÔÀÌ´Ù. ¿¹: AllowOverride FileInfo (¶Ç´Â All µµ °¡´É) À§¿Í °°Àº Á¶°Ç¸¸ ¸¸Á·ÇÑ´Ù¸é »ç¿ëÀÚ °èÁ¤¿¡¼­´Â .htaccess ÆÄÀÏÀ» ÀÌ¿ëÇؼ­ ÀÌÁ¦´Â ¸¶À½´ë·Î ¸¶ÀÓŸÀÔÀ» Á¶ÀýÇÒ ¼ö ÀÖ´Ù. ¸¸¾à ÀÌ¿Í °°Àº Á¶°ÇÀÌ ¸¸Á·ÇÏÁö ¾Ê´Â´Ù¸é ¼­¹ö°ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇØ º¸¼¼¿ä. ¾Æ¸¶ ´ëºÎºÐ À¥È£½ºÆà ¾÷ü¶ó¸é À§¿Í °°Àº ±â´ÉÀ» Æ÷ÇÔÇؼ­ Á»´õ ¸¹Àº ±â´ÉÀ» .htaccessÆÄÀÏ¿¡ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇØ ³õ¾ÒÀ» °ÍÀÌ´Ï Å©°Ô ¹®Á¦°¡ µÇÁö ¾Ê´Â´Ù. ÆÄÀÏ ¾÷·Îµå µð·ºÅ丮·Î À̵¿ÇÑ ´ÙÀ½ .htaccess ÆÄÀÏÀ» ¸¸µé°í ´ÙÀ½°ú °°ÀÌ text/html ¸¶ÀÓŸÀÔÀ» ÀçÁ¶Á¤ÇÕ´Ï´Ù. --- /path/to/file_upload_dir/.htaccess----------------- AddType text/html .html .htm ---------------------------------------------------------- ²À ÆÄÀÏ ¾÷·Îµå µð·ºÅ丮¿¡ Àû¿ëµÇ´Â °æ¿ì°¡ ¾Æ´Ï°í Àüü³ª ´Ù¸¥ ƯÁ¤ µð·ºÅ丮¿¡ Àû¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ¸¸¾à .htaccess ÆÄÀÏÀÇ ¹®¹ýÀÌ Æ²¸®¸é 500 ¿¡·¯¸¦ ³»¹Ç·Î ÁÖÀÇÇϱ⠹ٶø´Ï´Ù. ÀÌ·¸°Ô ¼³Á¤ÇÏ¸é ¿Ã¶ó¿Â ÆÄÀÏ(*.html)¿¡ ºñ·Ï php Äڵ尡 µé¾î°¡ ÀÖ´õ¶óµµ phpÄÚµå´Â Çؼ®ÇÏÁö ¾Ê°í À¥ºê¶ó¿ìÀú·Î ³Ñ°ÜÁֱ⠶§¹®¿¡ ¿øÇÏ´Â ¼³Á¤ÀÌ µÇ´Â ¼ÀÀÌ´Ù. ¸¸¾à, ÀÚ½ÅÀÇ È¨ÆäÀÌÁö°¡ È®½ÇÇÏ°Ô *.html *.htmÀº ¿ÀÁ÷ HTML Äڵ常 »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ¾çºÐµÇ¾î ÀÖ´Ù¸é ´ÙÀ½°ú °°ÀÌ DocumentRoot¿¡¼­ ¼³Á¤ ÇÒ ¼ö ÀÖ½À´Ï´Ù. --DocumentRoot/.htaccess ---------------------------------- AddType application/x-httpd-php .php .php3 .ph .lib .inc .conf AddType application/x-httpd-php-source .phps AddType text/html .html .htm ------------------------------------------------------------ ±×¸®°í *.ph *.inc *.lib µîµîÀÇ ¼³Á¤ ÆÄÀÏ¿¡ ´ëÇؼ­ Á÷Á¢ URL È£ÃâÀ» ±ÝÁö½ÃÅ°·Á¸é ´ÙÀ½°ú °°ÀÌ ¼³Á¤ÇÕ´Ï´Ù. --DocumentRoot/.htaccess ---------------------------------- Order allow, deny Deny from all AddType application/x-httpd-php .php .php3 .ph .lib .inc .conf AddType application/x-httpd-php-source .phps ----------------------------------------------------------- ¾Æ·¡´Â ½ÇÁ¦°¡ ÇÊÀÚ°¡ »ç¿ëÇÏ´Â ¼³Á¤ ³»¿ëÀÌ´Ï Âü°íÇϱ⠹ٶø´Ï´Ù. --DocumentRoot/.htaccess --------------------------------- Options FllowSymLinks MultiViews Order allow, deny Deny from all AddType application/x-httpd-php .php .php3 .ph .lib .inc .conf AddType application/x-httpd-php-source .phps AddType text/html .html .htm php_value auto_prepend_file /home/xxx/xxx/header.php php_value auto_append_file /home/xxx/xxx/footer.php ----------------------------------------------------------- Âü°í·Î) AllowOverride FileInfo ±â´ÉÀº ÇØ´ç µð·ºÅ丮¿¡ ´ëÇÑ ¹®¼­ ŸÀÔÀ» ÄÁÆ®·Ñ ÇÏ´Â ±â´ÉÀ¸·Î ´ÙÀ½°ú °°Àº Áö½ÃÀÚ¸¦ »ç¿ë°¡´ÉÇÕ´Ï´Ù. Addtype, DefaultType, ErrorDocument, ±âŸ