安装后,只能访问首页,访问分类和产品报错404

问题咨询 · V55V · 于 6年前 发布 · 4019 次阅读

安装后,只能访问首页,首页访问是正常的

点击页面的链接,里面的分类和产品,报错404

如何解决?

共收到 4 条回复
Fecmall#16年前 0 个赞

url中去掉index.php 需要nginx的rewrite

可以参考下我的nginx配置:

server {
#   listen     80  ;
	listen 443 ssl http2;
    ssl on;
    ssl_certificate /etc/letsencrypt/live/fecshop.appfront.fancyecommerce.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/fecshop.appfront.fancyecommerce.com/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;   
    server_name fecshop.appfront.fancyecommerce.com fecshop.appfront.es.fancyecommerce.com;
    root  /www/web/develop/fecshop/appfront/web;
	server_tokens off;
    
    index index.php index.html index.htm;
    access_log /www/web_logs/access.log wwwlogs;
    error_log  /www/web_logs/error.log  notice;
	location / {
        index index.html index.php; ## Allow a static html file to be shown first
        try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
        expires 30d; ## Assume all files are cachable

    }
	location  /. { ## Disable .svn  .git  .htaccess and other hidden files
        return 404;
    }

    location @handler { ## Magento uses a common front handler
        rewrite / /index.php;
    }

    location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
        rewrite ^(.*.php)/ $1 last;
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include fcgi.conf;
    }

	location ~ /sitemap.xml 
	{   
		if ($host  ~ .*appfront.es.fancyecommerce.com) {  
			rewrite ^/sitemap\.xml /sitemap_es.xml last;  
		}
	}

	location /fr/ {
        index index.php;
        if (!-e $request_filename){
                rewrite . /fr/index.php last;
        }
	}
	location /es/ {
        index index.php;
        if (!-e $request_filename){
                rewrite . /es/index.php last;
        }
	}

	location /cn/ {
        index index.php;
        if (!-e $request_filename){
                rewrite . /cn/index.php last;
        }
    }

	location /de/ {
        index index.php;
        if (!-e $request_filename){
                rewrite . /de/index.php last;
        }
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
            expires      30d;
    }

    location ~ .*\.(js|css)?$ {
            expires      12h;
    }


}
tju070#26年前 0 个赞

我也遇到这个问题,使用上面的配置可解决

haitian11#36年前 0 个赞

我的这样配置的,访问所有的二级页面都跳到首页了。这是怎么回事啊 二级页面的路径是https://www.123.com/wx_load/index.php/Column/index.html

server {

listen 443 ssl;
root /www/web/qi365lawyercom/public_html;
server_name www.4000428110.com;
ssl on;
index  index.html index.php index.htm;
ssl_certificate   cert/214341877220530.pem;
ssl_certificate_key  cert/214341877220530.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
    root /www/web/qi365lawyercom/public_html;
    index index.html index.php index.htm;
}
location ~ .*\.(php|php5)?$ {
        root           /www/web/qi365lawyercom/public_html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        include fastcgi.conf; 
    }
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
    rewrite ^(.*.php)/ $1 last;
}

}

Fecmall#46年前 0 个赞

@haitian11 #3楼 你不是玩fecshop的吧,看你的nginx配置,像是用的虚拟主机。

你看看你的奇葩路径:https://www.123.com/wx_load/index.php/Column/index.html

一个url同时存在 index.php index.html

帮不了。

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics