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

nginxα¾²Ì¬ÔõôÉèÖÃ

ÎÊÌ⣺ʲôÊÇ nginx α¾²Ì¬ÉèÖà £¿ÃÕµ×£ºÎ±¾²Ì¬ÊÇͨ¹ýÖØд url £¬½«¶¯Ì¬ url ת»»Îª¾²Ì¬ url £¬´Ó¶ø¸ÄÉÆÍøÕ¾µÄ seo ºÍÐÔÄÜ¡£°ì·¨£ºÌí¼Ó rewrite Ä £¿é£»½¨Éèα¾²Ì¬¹æÔò£»¼¤»î rewrite Ä £¿é£»ÖØÆô nginx¡£

nginx α¾²Ì¬ÉèÖÃ

ʲôÊÇα¾²Ì¬ £¿

α¾²Ì¬ÊÇͨ¹ýÔÚЧÀÍÆ÷¶Ë¶Ô URL ¾ÙÐÐÖØд £¬½«¶¯Ì¬ URL ת»»Îª¾²Ì¬ URL £¬´Ó¶øÈö¯Ì¬ÍøÕ¾¿´ÆðÀ´Ïñ¾²Ì¬ÍøÕ¾¡£Õâ¿ÉÒÔ¸ÄÉÆÍøÕ¾µÄ SEO ºÍÐÔÄÜ¡£

Nginx α¾²Ì¬ÉèÖð취£º

1. ÔÚ nginx ÉèÖÃÎļþÖÐÌí¼Ó rewrite Ä £¿é

load_module rewrite_module modules/ngx_rewrite.so;

µÇ¼ºó¸´ÖÆ

2. ½¨Éèα¾²Ì¬¹æÔò

ÔÚÉèÖÃÎļþÖÐÌí¼Ó rewrite Ö¸Áî £¬¹æÔòÈçÏ£º

# ½«´øÓÐ .html ºó׺µÄ URL ÖØдΪ index.php
rewrite ^(.+).html$ /index.php$1 last;

µÇ¼ºó¸´ÖÆ

´Ë¹æÔò½«½«ËùÓдøÓÐ “.html” ºó׺µÄ URL ÖØдΪÒÔ “index.php” ¿ªÍ·¡¢ºó׺ΪԭÀ´µÄ URL ºó׺µÄРURL¡£

3. ¼¤»îÖØдÄ £¿é

ÔÚ server ¿éÖÐ £¬¼¤»î rewrite Ä £¿é£º

server {
    ...
    rewrite_module on;
    ...
}

µÇ¼ºó¸´ÖÆ

4. ÖØÆô nginx

ÐÞ¸ÄÍê³Éºó £¬ÐèÒªÖØÆô nginx ЧÀÍÆ÷ÒÔÓ¦Óøü¸Ä¡£

ʾÀý£º

ÒÔÏÂʾÀý½«ËùÓдøÓÐ “.html” ºó׺µÄ URL ÖØдµ½ “index.php”£º

rewrite ^(.+).html$ /index.php$1 last;

µÇ¼ºó¸´ÖÆ

×¢ÖØ£º

α¾²Ì¬¹æÔòÖÐ £¬$1 ´ú±íµÚÒ»¸ö²¶»ñ×é¡£

last ±ê¼ÇÈ·±£¹æÔòÖ»Ó¦ÓÃÒ»´Î¡£

ÄúÐèҪƾ֤×Ô¼ºµÄÍøÕ¾ÐèÒªÐ޸ĹæÔò¡£

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

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

Ïà¹ØÐÂÎÅ

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

13452372176

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

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

QR code
ÍøÕ¾µØͼ