Reggie Wills
Reggie Wills

Reputation: 31

301 redirect of pages not working opencart

direct some pages to the homepage of opencart.

For examle: https://mywebsitenamehere.com/index.php?route=product/manufacturer

301 redirect to: https://mywebsitenamehere.com/

I would usually add something like this:

Redirect 301 /index.php?route=product/manufacturer https://mywebsitenamehere.com/

Snippet of my .htaccess:

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)

RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Thank you!!

Upvotes: 3

Views: 585

Answers (2)

Reggie Wills
Reggie Wills

Reputation: 31

UPDATE:

in (for example)

manufacturer.php

add the following to the very top:

<?php // to redirect page
header( 'Location: https://mywebsitenamehere.com/' ) ;
?>

Upvotes: 0

RavinderSingh13
RavinderSingh13

Reputation: 133760

Could you please try following, written and tested with shown samples. Please make sure you clear your browser cache before testing your URLs.

RewriteEngine ON
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]

RewriteCond %{QUERY_STRING} ^route=product/manufacturer [NC]
RewriteRule ^index\.php https://mywebsitenamehere.com [R=301,NC,L]

Upvotes: 1

Related Questions