Prestashop Multistore 上的 404 页面

Posted

技术标签:

【中文标题】Prestashop Multistore 上的 404 页面【英文标题】:404 Page On Prestashop Multistore 【发布时间】:2016-02-21 12:11:39 【问题描述】:

我刚刚在我的 1.6.1 prestashop 中启用了多商店,并在我的默认商店之外添加了一个新商店。默认商店地址: http://lak-lak.ir新多店地址:http://lak-lak.ir/ghods

新店首页似乎一切正常,但是在参考联系我们、畅销等页面时,Prestashop 显示 404 错误页面。

如何解决这个问题?

P.S. 我的商店也启用了 URL 重写。 这是.htaccess文件的内容:

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on


#Domain: lak-lak.ir
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %ENV:REWRITEBASEwebservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$1$2$3.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/c/$1$2$3.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]


#Domain: lak-lak.ir
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]

RewriteRule ^api/(.*)$ %ENV:REWRITEBASEwebservice/dispatcher.php?url=$1 [QSA,L]

RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^ghods$ /ghods/ [L,R]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^ghods/(.*) /$1 [L]

# Images
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$1$2$3.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/c/$1$2$3.jpg [L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %ENV:REWRITEBASEimg/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %REQUEST_FILENAME -s [OR]
RewriteCond %REQUEST_FILENAME -l [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^.*$ - [NC,L]
RewriteCond %HTTP_HOST ^lak-lak.ir$
RewriteRule ^.*$ %ENV:REWRITEBASEindex.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
<IfModule mod_headers.c>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|svg)$">
        Header add Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

【问题讨论】:

你有第二家店的网址吗? @gskema 我定义了,奇怪的是当我安装两种语言时一切都很好。 URL 如下所示:http://myshop.com/store1/en/,订单页面 URL 如下所示:http://myshop.com/store1/en/order。当我删除第二语言 url 将自动更改为 http://myshop.com/store1/en/order 并显示 404 错误页面。 看起来像路由/缓存错误,尤其是关于 ISO 代码。 尝试禁用和启用 BO 中的 url_rewriting 重新生成 httacess 文件 @tarekfellah 我做了这个动作,但没有帮助。在我的情况下,重新生成 .htaccess 文件没有帮助。 【参考方案1】:

我过去遇到过这个问题,我通过以下方式解决了这个问题:

您必须确保在 apache 服务器中您已启用 mod 重写 并设置 AllowOverride all目录

看看这些主题:

How to enable mod_rewrite for Apache 2.2

How to Set AllowOverride all

希望这对你有用:)

【讨论】:

以上是关于Prestashop Multistore 上的 404 页面的主要内容,如果未能解决你的问题,请参考以下文章

多商店,使用 prestashop 手动激活帐户

Prestashop 1.7 上的 Prestashop1.6 主题

如何删除 prestashop 1.7 上的送货步骤?

php Magento 2 Multistore进行测试

如何使用 prestashop 1.7 上的模块在前台创建自定义页面

Prestashop 无法以管理员身份登录