mod_rewrite ã§URLãæ¸ãæããå ´åã® PHP_SELF ã®å¤ã¯ãRewriteRule ã .htaccess ã«æ¸ãã httpd.conf ã«æ¸ããã«ãã£ã¦éã£ã¦ãããhttp://example.com/foo/bar ã http://example.com/index.php ã«æ¸ãæããå ´åã«ã¤ãã¦ä¾ç¤ºããã¨ä»¥ä¸ã®ããã«ãªãã .htaccessã«æ¸ãå ´å
mod_rewriteã®RewriteRuleã§ã¯ã¨ãªãå¼ãç¶ãããå ´åã¯ãQSAãã©ã°ã使ãããã¨ãæè¿ç¥ãã¾ããã ãã¨ãã°æ¬¡ã®ãããªURLããªã¯ã¨ã¹ããã¾ãã http://example.com/status/fkoji?count=10 ãµã¼ãå´ã§å®ç¾©ãã¦ãã RewriteRule ã¯æ¬¡ã®ãããªãã®ã§ãã RewriteRule /([^/]+)/([^/]+) index.php?controller=$1&user_name=$2 [L] ãã®å ´åããªã©ã¤ãå¾ã®URLã¯ã http://example.com/index.php?controller=status&user_name=fkoji ã¨ãªã£ã¦å ã åå¨ãã¦ãã count ã¯ã¨ãªãæ¶ãã¦ãã¾ã£ã¦å°ãã¾ãã ããããå ´åã«QSAãã©ã°ã使ããã¨ãã§ãã¾ãã RewriteRule /([^/]+)/([^/]+)
ãã®ããã«ä¾¿å©ãª Rewrite æ©è½ã¯ãåå¥ãã£ã¬ã¯ããªã«è¨ç½®ããã .htaccess ã«ãæå®ãããã¨ãã§ããããããã.htaccess ã«æ¸ããã®ã¯ RewriteEngine, RewriteBase, RewriteCond, RewriteRule ã ãã§ããã®ã³ã°ã«é¢ããæå®åãªã©ã¯æ¸ããªãããè²ã ã¨æ³¨æãã¹ããããªç¹ããããããã§ã¯ããããä¸æ°ã«è§£èª¬ãããã¨æããããã¯ç®¡çè ã«ãªããªãï¼ï¼httpd.confãç·¨éã§ããªãï¼ä¸è¬ã¦ã¼ã¶ã«ã¨ã£ã¦ã¯éè¦ãªæ å ±ã«ãªãã ãããã .htaccess ã¯åå¥ã®å ¬éãã£ã¬ã¯ããªã«è¨ç½®ããã¦ãç´°ããå¶å¾¡ãåºæ¥ããã®ã§ãããåå¥ãã£ã¬ã¯ããªã«ã¢ã¯ã»ã¹å¶éãå ¥ãããããã®ã«ä½¿ããããããããã¤ãã® Apache æå®åã¯ãããã«ãæ¸ãããã幸ããªãã¨ã« Rewriteæ©è½ï¼æ£ç¢ºã«ã¯ mod_rewrite.soï¼ã¯ããã® .htacces
mod_rewriteã¨ã¯ Apacheã®ã¢ã¸ã¥ã¼ã«ã®ã²ã¨ã¤ã§ãã¢ã¯ã»ã¹URLãæ£è¦è¡¨ç¾ã§æ¸ãæãããã¨ãã§ãã¾ãããªãã¤ã¬ã¯ãå¦çãè¡ãã®ã«ä¾¿å©ãªã¢ã¸ã¥ã¼ã«ã§ãã ã¢ã¸ã¥ã¼ã«ã®è§£èª¬ããã¥ã¡ã³ãã«ããã° URLãæä½ããããã®ã¹ã¤ã¹è£½ã®ã¢ã¼ãã¼ãã¤ã ã¨ä¾ããããã»ã©ãé常ã«è¤éãªå¦çãè¡ãã¾ãã URLããURLã¸ãåä¸ãµã¼ãå URLã ããããå¥ãµã¼ãURLã ãããåãã¾ããã å¼æ°ãå«ãåçURLãé常ã®HTMLãã¡ã¤ã«ã®ãããªéçURLã«è¦ãããã¨ãå¯è½ã§ãã ç´ æ´ããã詳細ãªããã¥ã¢ã«ãããã¾ãããæ©è½ãå¤ãã ãã«æ å ±éãå¤ãèªãã®ãé¢åã ã¨æãã¾ãã®ã§ãããã§ã¯ãmod_rewriteã使ç¨ããã¨ä¾¿å©ãªå ´é¢ãæ³å®ãã¦å ·ä½çã«è§£èª¬ãã¦ã¿ããã¨æãã¾ãã mod_rewriteã®åºæ¬ ã²ã¨ã¾ããmod_rewriteã¯Apacheã®ã¢ã¸ã¥ã¼ã«ã§ããã¤ã³ã¹ãã¼ã«ããã¦ããªããã°ããµã¼ã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}