Prestashop-.htaccess URL重写(添加个人链接)

Prestashop-.htaccess URL重写(添加个人链接),.htaccess,url-rewriting,prestashop,.htaccess,Url Rewriting,Prestashop,我想知道为什么个人链接(用于url重写)不能与Prestashop一起使用 我使用(在文件末尾添加)进行了测试: 但它不起作用。我在网上搜索了一下,但没有找到什么。。。 Prestashop的默认URL重写工作正常,但我无法添加其他链接 你能帮我吗?你需要更多的信息吗 谢谢 htaccess文件: # ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this com

我想知道为什么个人链接(用于url重写)不能与Prestashop一起使用

我使用(在文件末尾添加)进行了测试:

但它不起作用。我在网上搜索了一下,但没有找到什么。。。 Prestashop的默认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>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
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:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/javascript "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType application/x-javascript "access plus 1 week"
    ExpiresByType image/x-icon "access plus 1 year"
</IfModule>

FileETag INode MTime Size
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
</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

## Ajout manuelle ##
# RewriteRule ^kit-chaine-afam.htm$ /content/6-kit-chaine-afam [L]
RewriteRule ^www.accessoires-de-la-moto.com/kit-chaine-afam.htm$ /index.php?id_cms=6&controller=cms [L]
RewriteRule ^/test$ /index.php [L]
RewriteRule ^www.accessoires-de-la-moto.com/test2$ www.accessoires-de-la-moto.com/index.php [L]

RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^test3$ %{ENV:REWRITEBASE}index.php [L]
#~~开始~~不要删除此注释,当再次生成.htaccess时,Prestashop将自动将代码保留在此注释之外
#.htaccess由PrestaShop电子商务开源解决方案自动生成
# http://www.prestashop.com - http://www.prestashop.com/forums
重新启动发动机
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则[E=REWRITEBASE://]
重写规则^api/?(*)$%{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1[QSA,L]
#图像
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])(\-[\u a-zA-Z0-9-]*)?([0-9]+)?/.+\.jpg$%{ENV:REWRITEBASE}img/p/$1/$2$3.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])([0-9])(\-[\u a-zA-Z0-9-]*)?([0-9]+)?/.+\.jpg$%{ENV:REWRITEBASE}img/p/$1/$2/$3$4.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])([0-9])([0-9])(\-[\u a-zA-Z0-9-]*)?([0-9]+)?/.jpg$%{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])([0-9])([0-9])([0-9])(\-[\u a-zA-Z0-9-]*)?([0-9]+)?/.jpg$%{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[\u a-zA-Z0-9-]*)?([0-9]+)?/.jpg$%{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[\u a-zA-Z0-9-]*)?([0-9]+)/.jpg$%{ENV:REWRITEBASE}img/p/$1/$2/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[u a-zA-Z0-9-])?([0-9]+)/。+\.jpg$%{ENV:REWRITEBASE}img/p/$1/$3/$4/$6/$7/$1$2$3$4$5$7$8$9.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[u a-zA-Z0-9-]*)?([0-9]+)/。+\.jpg$%{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$8/$1$2$3$4$6$7$8/$9$10.jpg]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^c/([0-9]+)(\-[\.*U a-zA-Z0-9-]*)([0-9]+)?/.+\.jpg$%{ENV:REWRITEBASE}img/c/$1$2$3.jpg[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^c/([a-zA-Z-]+)([0-9]+)?/.+\.jpg$%{ENV:REWRITEBASE}img/c/$1$2.jpg[L]
#调度员
RewriteCond%{REQUEST_FILENAME}-s[或]
RewriteCond%{REQUEST_FILENAME}-l[或]
RewriteCond%{REQUEST_FILENAME}-d
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^.*$-[NC,L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^.*${ENV:REWRITEBASE}index.php[NC,L]
过期于
ExpiresByType image/gif“访问加1个月”
过期按类型图像/jpeg“访问加1个月”
ExpiresByType图像/png“访问加1个月”
ExpiresByType文本/css“访问加1周”
ExpiresByType文本/javascript“访问加1周”
ExpiresByType应用程序/javascript“访问加1周”
ExpiresByType应用程序/x-javascript“访问加1周”
过期按类型图像/x图标“访问加1年”
FileETag索引节点MTime大小
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE应用程序/javascript
AddOutputFilterByType DEFLATE应用程序/x-javascript
#如果未启用“重写模式”
ErrorDocument 404/index.php?控制器=404
#~~end~~不要删除此注释,当再次生成.htaccess时,Prestashop将自动将代码保留在此注释之外
##阿约特·曼纽尔##
#重写规则^kit-chaine-afam.htm$/content/6-kit-chaine-afam[L]
重写规则^www.accessoires-de-la-moto.com/kit chaine afam.htm$/index.php?id\u cms=6&controller=cms[L]
重写规则^/test$/index.php[L]
重写规则^www.accessoires-de-la-moto.com/test2$www.accessoires-de-la-moto.com/index.php[L]
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
重写规则^test3$%{ENV:REWRITEBASE}index.php[L]
这两个

RewriteRule ^www.accessoires-de-la-moto.com/kit-chaine-afam.htm$ /index.php?id_cms=6&controller=cms [L]
RewriteRule ^www.accessoires-de-la-moto.com/test2$ www.accessoires-de-la-moto.com/index.php [L]
无法工作,因为域不是URL路径模式的一部分

这条规则应该有效

但这条规则来自普雷斯塔肖普

RewriteRule ^.*$ - [NC,L]
阻止它

您可以将规则移动到Prestashop定义之上

RewriteRule ^test$ /index.php [L]

# ~~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>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
...
RewriteRule^test$/index.php[L]
#~~开始~~不要删除此注释,当再次生成.htaccess时,Prestashop将自动将代码保留在此注释之外
#.htaccess由PrestaShop电子商务开源解决方案自动生成
# http://www.prestashop.com - http://www.prestashop.com/forums
重新启动发动机
重写cond%{HTTP_HOST}^www.accessoires-de-la-moto.com$
...
然后,
/test
规则将按预期工作。但要小心不要干扰Prentashop的规则。

您在htacces文件中尝试过简单的“重定向永久”吗

    RedirectPermanent /old_page_urlp /new_page_url

工作正常吗?

您只需进入“首选项->搜索引擎优化和URL”。在“设置URL”部分,将友好URL切换为“是”。

您可以从“管理”面板更改URL重写配置和规则:

首选项->搜索引擎优化和URL->URL模式


没有,我做了其他测试,但仍然不起作用。我用完整的代码更新了我的帖子。谢谢你的解释,但仍然不能像你看到的那样工作://我应该删除“RewriteRule^.*$-[NC,L]?@Snow这可能与前导或尾随斜杠有关,我将模式改为RewriteRule ^test$ /index.php [L] # ~~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> RewriteEngine on RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$ ...
    RedirectPermanent /old_page_urlp /new_page_url