×ðÁú¿­Ê±¹ÙÍøµÇ¼

laravel¹Ø±Õα¾²Ì¬

ÔÚlaravelÖУ¬Î±¾²Ì¬£¨Ò²³ÆΪurlÖØд£©ÊÇÒ»ÖÖ³£¼ûµÄÊÖÒÕ£¬ÓÃÓÚʹҳÃæurlÔ½·¢ÑŹÛÇÒÒ×ÓÚÃ÷È·¡£Ö»¹Üα¾²Ì¬´øÀ´ÁËÖî¶àÓŵ㣬µ«ÔÚijЩÇéÐÎÏ£¬ÎÒÃÇ¿ÉÄÜÐèÒª¹Ø±Õα¾²Ì¬¡£±¾ÎĽ«Ì½ÌÖÔÚlaravelÖйرÕα¾²Ì¬µÄÒªÁ죬ÒÔ¼°ÕâÖÖÐÐΪµÄ¿ÉÄÜÓ°Ïì¡£

ʲôÊÇα¾²Ì¬£¿

α¾²Ì¬ÊÇÒ»ÖÖWebЧÀÍÆ÷µÄÊÖÒÕ£¬Ëü¿ÉÒÔ½«¾ßÓж¯Ì¬²ÎÊýµÄURLת»»Îª¾ßÓо²Ì¬Íâ¹ÛµÄURL¡£ÀýÈ磬ÎÒÃÇ¿ÉÄܻὫÀàËÆÓÚ¡°/article.php?id=123¡±ÕâÑùµÄ¶¯Ì¬URLת»»Îª¡°/article/123¡±µÄ¾²Ì¬URL¡£Õâ´ó´óÌá¸ßÁËURLµÄ¿É¶ÁÐÔºÍËÑË÷ÒýÇæÓѺöÈ¡£

ÔÚLaravelÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýʹÓá°.htaccess¡±Îļþ»òNginxÉèÖÃÀ´ÆôÓÃα¾²Ì¬¡£ÕâЩÉèÖý«Ê¹ÎÒÃÇ¿ÉÒÔʹÓÃÀàËÆ¡°/article/123¡±µÄ¾²Ì¬URL¶ø²»ÊÇ¡°/article.php?id=123¡±µÄ¶¯Ì¬URL¡£

ΪʲôҪ¹Ø±Õα¾²Ì¬£¿

Ö»¹Üα¾²Ì¬´øÀ´ÁËÐí¶àÓŵ㣬µ«ÓÐʱÎÒÃÇ¿ÉÄÜÐèÒª½ûÓÃËü¡£ÏÂÃæÊǼ¸¸ö¿ÉÄܻᵼÖ¹رÕα¾²Ì¬µÄÔµ¹ÊÔ­ÓÉ¡£

ÉèÖÃÎÊÌâ

ÔÚijЩÇéÐÎÏ£¬Î±¾²Ì¬µÄÉèÖÿÉÄܲ¢²»×¼È·¡£Õâ¿ÉÄܵ¼ÖÂÓû§¿´µ½404¹ýʧҳÃæ»òÆäËûÎÊÌâ¡£¹Ø±Õα¾²Ì¬¿ÉÒÔ×ÊÖúÎÒÃÇɨ³ý´ËÀàÎÊÌâ¡£

ϵͳÐÔÄÜ

ÆôÓÃα¾²Ì¬¿ÉÄÜ»á¶ÔϵͳÐÔÄܱ¬·¢Ó°Ïì¡£ÓÉÓÚWebЧÀÍÆ÷ÐèÒª´¦Àí¾²Ì¬URL²¢½«ÆäÖØдΪ¶¯Ì¬URL£¬Õâ¿ÉÄܻᵼÖÂÒ»¶¨µÄÌØÊâ¼ç¸º¡£¹Ø±Õα¾²Ì¬¿ÉÒÔÌá¸ßϵͳµÄÐÔÄÜ¡£

¾²Ì¬Îļþ³åÍ»ÎÊÌâ

ÔÚα¾²Ì¬ÆôÓõÄÇéÐÎÏ£¬ÈôÊÇÎÒÃÇʵÑéÔÚWebÎĵµ¸ùĿ¼Öн¨ÉèÒ»¸öÃûΪ¡°article¡±µÄÎļþ¼Ð£¬¿ÉÄ᷺ܻÆðÎÊÌâ¡£ÓÉÓÚα¾²Ì¬Ê¶±ð¡°/article/123¡±ÕâÑùµÄURLΪ¶¯Ì¬Â·ÓÉ£¬Òò´ËÎÒÃÇ¿ÉÄÜÎÞ·¨»á¼û¸ÃÎļþ¼ÐÖеÄÎļþ¡£

ÔõÑù¹Ø±Õα¾²Ì¬£¿

ÔÚLaravelÖйرÕα¾²Ì¬µÄÒªÁìÈ¡¾öÓÚÎÒÃÇÑ¡ÔñµÄWebЧÀÍÆ÷¡£ÏÂÃæÎÒÃǽ«»®·ÖÌÖÂÛÔõÑù¹Ø±ÕApacheºÍNginxÖеÄα¾²Ì¬¡£

¹Ø±ÕApacheÖеÄα¾²Ì¬

ÈôÊÇÒª¹Ø±ÕApacheÖеÄα¾²Ì¬£¬ÎÒÃÇÐèÒª·­¿ª¡°.htaccess¡±Îļþ²¢ÐÞ¸ÄÆäÖеÄÄÚÈÝ¡£

ÔÚLaravelÖУ¬ÎÒÃǵġ°.htaccess¡±Îļþͨ³£¿´ÆðÀ´ÏñÕâÑù£º

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

µÇ¼ºó¸´ÖÆ

Òª¹Ø±Õα¾²Ì¬£¬ÎÒÃÇÐèҪעÊ͵ô×îºóÒ»ÐС°RewriteRule ^ index.php [L]¡±£¬È»ºóÖØÆôApacheЧÀÍÆ÷¡£

¹Ø±ÕNginxÖеÄα¾²Ì¬

ÈôÊÇÒª¹Ø±ÕNginxÖеÄα¾²Ì¬£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÐÞ¸ÄserverÉèÖÃÎļþÀ´ÊµÏÖ¡£ÔÚLaravelÖУ¬Í¨³£Î»ÓÚ¡°/etc/nginx/sites-available¡±µÄÎļþÃüÃûΪ¡°laravel¡±»ò¡°laravel.conf¡±¡£

ÎÒÃÇÐèÒª±à¼­¸ÃÎļþ²¢ÕÒµ½ÒÔÏÂÐУº

location / {
            try_files $uri $uri/ /index.php?$query_string;
        }

µÇ¼ºó¸´ÖÆ

Òª¹Ø±Õα¾²Ì¬£¬ÎÒÃÇÐèÒª½«ÆäÌ滻ΪÒÔÏÂÄÚÈÝ£º

location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }

µÇ¼ºó¸´ÖÆ

È»ºóÎÒÃÇÐèÒªÖØÆôNginxЧÀÍÆ÷¡£

×¢ÖØÊÂÏî

¹Ø±Õα¾²Ì¬¿ÉÄÜ»áʹ¶¯Ì¬URL±äµÃÔ½·¢ÈÝÒ×Êܵ½ºÚ¿Í¹¥»÷¡£ÀýÈ磬ÈôÊÇÎÒÃǹرÕα¾²Ì¬²¢Ê¹Óá°/article.php?id=123¡±ÕâÖÖ¶¯Ì¬URL£¬ºÚ¿Í¿ÉÒÔ¸üÈÝÒ×µØʹÓøÃURL¾ÙÐй¥»÷¡£Òò´Ë£¬ÔڹرÕα¾²Ì¬Ö®Ç°£¬ÎÒÃÇÓ¦¸ÃÆÀ¹ÀÆä¿ÉÄÜ´øÀ´µÄΣº¦²¢¾öÒéÊÇ·ñÖµµÃʹÓö¯Ì¬URL¡£

½áÂÛ

ÔÚLaravelÖйرÕα¾²Ì¬¿ÉÄܲ»ÈçÆôÓÃʱÄÇô³£¼û£¬µ«ÔÚijЩÇéÐÎÏÂÊÇÐëÒªµÄ¡£ÎÞÂÛÎÒÃǾöÒé¹Ø±ÕÕÕ¾ÉÆôÓÃα¾²Ì¬£¬ÎÒÃǶ¼Ó¦¸Ã×ÐϸÆÀ¹ÀÆä¿ÉÄÜ´øÀ´µÄΣº¦ºÍÓŵ㣬²¢Æ¾Ö¤ÏêϸÇéÐÎ×ö³ö¾öÒé¡£

ÒÔÉϾÍÊÇlaravel¹Ø±Õα¾²Ì¬µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ