我正在尝试让 SEO URL 在 OpenCart 中的多个商店中工作。
我在管理员中有两家商店
http://www.shop.com (default)
http://m.shop.com
SEO URL 适用于http://www.shop.com 但它们为http://m.shop.com返回 not_found.tpl(404 页面)
但是,这有效:
http://m.shop.com/index.php?route=product/product&path=68&product_id=52
SEO明智的,应该是
/index.php?route=product/product&path=68&product_id=52
http://www.shop.com/product-title
http://m.shop.com/product-title (404 returned)
我正在使用 NGINX。这是配置:
www.shop.com
server {
server_name www.shop.com;
listen 80;
root /var/www/www.shop.com/;
index index.php index.html;
location /image/data {
autoindex on;
}
location / {
try_files $uri @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
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;
}
}
m.shop.com
server {
server_name m.shop.com;
listen 80;
root /var/www/www.shop.com/;
index index.php index.html;
location /image/data {
autoindex on;
}
location / {
try_files $uri @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
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;
}
}