htaccess изменились ссылки

T
На сайте с 20.05.2008
Offline
46
2233

Уважаемые гуру, помогите пожалуйста с редиректом

URL был вида /product.php?id_product=4, то теперь URL изменился на /index.php?id_product=4&controller=product

В поисковике URL вида /product.php?id_product=4

Но теперь по ним 404 на сайте

Как сделать, что бы работали эти ссылки?

Вопрос срочный, готов оплатить помощь.

Сейчас 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_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

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


# Disable Multiviews
Options -Multiviews

RewriteEngine on
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
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]
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]
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]
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]
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]
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]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
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
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff

#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
J
На сайте с 20.02.2014
Offline
120
jkm
#1

Сразу после RewriteEngine on вставить


RewriteCond %{QUERY_STRING} ^id_product=(\d+)$
RewriteRule ^product\.php$ /index.php?id_product=%1&controller=product [L,R=301]
T
На сайте с 20.05.2008
Offline
46
#2

Большое спасибо, сделал так

RewriteCond %{QUERY_STRING} ^id_product=([0-9]*)$

RewriteRule ^product.php$ index.php?id_product=%1&controller=product [L,R=301]


---------- Добавлено 03.08.2014 в 16:11 ----------

Может кому ещё пригодится

При переходе с кмс prestashop 1.4 или 1.5 на 1.5.Х или 1.6

Меняются ссылки, для примера

 /product.php?id_product=4, то теперь URL изменился на /index.php?id_product=4&controller=product

Но не только ссылки на продукты но и все остальное, везде добавляется

&controller=

Для того, что бы не потерять в поисковиках Добавляем в .htaccess

RewriteEngine on


RewriteCond %{QUERY_STRING} ^id_product=([0-9]*)$
RewriteRule ^product.php$ index.php?id_product=%1&controller=product [L,R=301]

RewriteCond %{QUERY_STRING} ^id_category=([0-9]*)$
RewriteRule ^category.php$ index.php?id_category=%1&controller=category [L,R=301]

RewriteCond %{QUERY_STRING} ^id_cms=([0-9]*)$
RewriteRule ^cms.php$ index.php?id_cms=%1&controller=cms [L,R=301]

RewriteCond %{QUERY_STRING} ^id_manufacturer=([0-9]*)&p=([0-9]*)$
RewriteRule ^manufacturer.php$ index.php?id_manufacturer=%1&p=%1=&controller=manufacturer [L,R=301]
J
На сайте с 20.02.2014
Offline
120
jkm
#3

В переменную %1 попадает то, что в первых скобках. В переменную %2 то, что во вторых.

А то у Вас там id_manufacturer=%1&p=%1=


RewriteCond %{QUERY_STRING} ^id_manufacturer=([0-9]*)&p=([0-9]*)$
RewriteRule ^manufacturer.php$ index.php?id_manufacturer=%1&p=%2&controller=manufacturer [L,R=301]
siv1987
На сайте с 02.04.2009
Offline
427
#4


RewriteEngine on

RewriteCond %{QUERY_STRING} ^((?:id_product|id_category|id_cms)=[0-9]+)$
RewriteRule ^(product|category|cms)\.php /index.php?%1&controller=$1 [R=301,L]

RewriteCond %{QUERY_STRING} ^(id_manufacturer=[0-9]+(?:&p=[0-9]+)?$
RewriteRule ^(manufacturer)\.php$ /index.php?%1&controller=manufacturer [L,R=301]

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий