2013-03-25 36 views
9

OpenCart, SEO URL'lerini nginX'de kullanabilir mi? Apache'de, bir .htaccess yarattığını anlıyorum, ancak nginX'te URL yönlendirmesini otomatik olarak yönetebiliyor mu?nginX'de OpenCart

+0

Denemenizi engellemek nedir? – shadyyx

cevap

16

Nginx'te OpenCart - Bir yıldır kullanıyoruz. Sonunda onu kullanmaya başlayan başka insanlar görünüyor. .. yardım alma bir kabus ve Nginx üzerinde alıyorsanız bazen zordur

Benim www.site.com.vhost altındadır, örnek: sitenizi yönetmek açısından artık

# FORCE WWW 
server { 
    server_name site.com; 
    rewrite ^(.*) http://www.site.com$1 permanent; 
} 
# MAIN SERVER 
# NINX 0.8.54 - WORKS ON 1.1.19 
server { 
    server_name www.site.com; 
    listen 80; 
    root /var/www/www.site.com/web; 
    index index.php index.html; 
    location /image/data { 
     autoindex on; 
    } 
    location /admin { 
     index index.php; 
    } 
    location/{ 
     try_files $uri @opencart; 
    } 
    location @opencart { 
     rewrite ^/(.+)$ /index.php?_route_=$1 last; 
    } 
    location = /favicon.ico { 
     log_not_found off; 
     access_log off; 
    } 
    location = /robots.txt { 
     allow all; 
     log_not_found off; 
     access_log off; 
    } 
    # Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS! 
    location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ { 
     deny all; 
    } 
    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). 
    location ~ /\. { 
     deny all; 
     access_log off; 
     log_not_found off; 
    } 
    location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ { 
     expires max; 
     log_not_found off; 
    } 
    location ~ \.php$ { 
     try_files $uri =404; 
     include /etc/nginx/fastcgi_params; 
     fastcgi_pass 127.0.0.1:9000; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    } 
} 

Tamam. Artık, yönetici aracılığıyla SEO etkinleştirmek Ben de rota = index.php kaldırma hakkında okuma tavsiye location/{}

ile tüm URL'ler ve daha fazla özelleştirme için benim diğer mesaj tagged nginx and opencart görebilirsiniz - Aşağıdaki linki:?

Remove index.php?route=common/home from OpenCart

+1

güzel yanıt, +1 –

+0

Ayrıca “audoindex on” da dikkatli olmalıyım, çünkü bu bir CDN kullanıyoruz ve bu klasörleri özel tutmak en iyisi olurdu. – TheBlackBenzKid

+0

Lütfen kurulumunuzu ayrıntılı olarak detaylandırabilir misiniz? Yapılandırmayı kullanmayı denedim, ancak hiç işe yaramıyor. FastCGI ayarlarınız vb. Hakkında bilgi ediniyorum. –

İlgili konular