routing.yml 㨠AllowEncodedSlashes ã¨ã
apacheç°å¢ã®symfonyã«ã¦ã
routing.yml ã使ã£ã¦ã
http://hostname/index.php/tag/index?tagname=(ä½ãæåå)
ã
http://hostname/index.php/tag/(ä½ãæåå)
ã®ãããªURLã§ã¢ã¯ã»ã¹å¯è½ã«ãã¦ãæ´ã«mod_rewriteã§
http://hostname/tag/(ä½ãæåå)
ã§ã¢ã¯ã»ã¹å¯è½ã«ãããã¨ãã£ããã¨ãæè¿è¯ãããã®ã§ããããã®æååãã©ã¡ã¼ã¿ã« åè§ã¹ã©ãã·ã¥ãå ¥ã£ã¦ããã¨é¢åãªãã¨ã«ãªãã¾ããã¯ã¾ã£ã¦ãã¾ãã¾ããã
渡ããããã©ã¡ã¼ã¿ã仮㫠"news/sports" ã¨ãã¾ãã
åè§ã¹ã©ãã·ã¥ãæ®éã«URLã¨ã³ã³ã¼ããã¦æ¸¡ãã¨ã404ã¨ã©ã¼ã«ã
ã¹ã©ãã·ã¥ãã®ã¾ã¾ã ã¨ãã©ã¡ã¼ã¿ãéä¸ã§åºåããã¦ãã¾ãã®ã§URLã¨ã³ã³ã¼ãã¯å¿
é ã ãã
url_for çã®ãã«ãã¼ã§ã以ä¸ã®ããã«åæã«URLã¨ã³ã³ã¼ããã¦ããã¾ããã404ã¨ã©ã¼ã«ãªã£ã¦ãã¾ãã¾ããã
http://hostname/tag/news%2Fsports
â apacheå´ã§ AllowEncodedSlashes On ã«ãã¦è§£æ¶ããã¾ããã
no_script_name: off ã®ç°å¢ã ã¨ã"%2F" ã®æåã§ãã©ã¡ã¼ã¿ãéåããã
PATH_INFO ã®ä¸ãæ¢ã«ãã³ã¼ãããã¦ãã¾ãããï¼ãªããããªãã®ãã¯èª¿ã¹ã¦ã¾ããï¼
ã¾ãããã©ã¡ã¼ã¿åå¾æ¹æ³ãï¼ãã¿ã¼ã³ããããã§
http://hostname/tag/news%2Fsports â REQUEST_URIããåå¾ â %2Fããã³ã¼ãããã¦ãªãã¦OK http://hostname/index_dev.php/tag/news%2Fsports â PATH_INFOããåå¾ â %2Fããã³ã¼ãããã¦ã¦NG
ã¨ãã£ãç¶æ³ã®ãããã¹ã©ãã·ã¥ãï¼éã¨ã¹ã±ã¼ããããããªå¯¾çãããã¨ãä»åº¦ã¯prodå´ã®ãã©ã¡ã¼ã¿ã®ã»ãããã¨ã³ã³ã¼ãã®è§£ãã¦ãªãç¶æ ã§sfRequestã«ãã©ã¡ã¼ã¿ãå ¥ã£ã¦ããç¶æ ã«ãªã£ã¦ãã¾ãã¾ãã
devã¨prodã§æåãéããã¨ãããããããåé¡ã«ãã©ãçãã¦ãã¾ãã¾ããã
ä»ã®ã¨ããã¯ä¸æ¦ãã³ã³ããã¼ã©ã®genUrlãä¸æ¸ããããµãã¯ã©ã¹ã使ã£ã¦ãããã¢ãããã¯ãªä¸æ¸ãã§åé¿ããã¦ã¾ãããããæ¹æ³ããªãã調æ»ä¸ã§ãã
ï¼ãããªã½ã¼ã¹ãæãã®ãã©ããã¨ãããã¾ããããããªæãã§ãã»ã»ã»ã¯ããå¥ãªæ¹æ³ã«ããªãã¨ããï¼
public function genUrl( $parameters = array(), $absolute = false ) { $url = parent::genUrl( $parameters, $absolute ); return sfConfig::get('sf_no_script_name') ? $url : str_replace( '%2F', '%252F', $url ); }