gpt4 book ai didi

php - 使用 Nginx 在 OpenCart 上的多个商店和子域上启用 SEO URL

转载 作者:可可西里 更新时间:2023-10-31 22:14:16 25 4
gpt4 key购买 nike

我正在尝试让 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;
}
}

最佳答案

我从某人那里得到了这篇文章和详细信息,我公司的 SEO 和营销团队正在使用这个工具..

来自 Setup SEO Full Friendly URLs on nginx在 XenForo 论坛上:

It's actually really really simple.

Considering you have uploaded XenForo into the directory "community", just add this to your nginx config:

location /community/ {
index index.php index.html index.htm;
try_files $uri $uri/ /community/index.php?$uri&$args;
}

While you are at it you might also want to add this to block external access to the folders "internal_data" and "library".

location ~ ^/community/(internal_data|library)/(.*)$ {
internal;
}

Restart nginx and enable Full Friendly URLs.

来自 Straight Forward Easy Instructions for Multi-Store Setup?在 Opencart 论坛上:

The short version is:
create 2 demo sub domains
subA.domain.com
subB.domain.com
and "point" both sub domains to the same folder on your web host.
i.e. public_html/shop
Install opencart to the first sub domain and then go through the admin and add an extra store.

So you'll have Shop1 subA.domain.com and Shop2 subB.domain.com both running the same code.

希望这是有道理的。

关于php - 使用 Nginx 在 OpenCart 上的多个商店和子域上启用 SEO URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16424651/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com