Page 1 of 1

problem with redirect 301

Posted: Wed Dec 12, 2018 8:14 am
by acjp
hi,
i try to make redirect 301 but i can't find a right setting.
it is my .htacces:

Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>

# 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/

RewriteCond %{HTTP_HOST} ^(www\.)?sample.com$
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.sample.com/%{REQUEST_URI} [NC,L,R]

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) 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]
RewriteRule ^it/oldcategory1/oldcategory2/product$ https://www.sample.com/it/newcategory1/ ... y2/product [L,R=301]

is it correct?

thanks a lot

Re: problem with redirect 301

Posted: Wed Dec 12, 2018 11:53 am
by IP_CAM
Well, your Link shows a Subdirectory:
https://www.sample.com/it/...
but your Rewrite Base is empty:
RewriteBase /
And that does not match! :(
Ernie

Re: problem with redirect 301

Posted: Wed Dec 12, 2018 5:20 pm
by acjp
Thank you for your answer.
sorry but I'm not expert, could you tell me more?
I've tried both
RewriteBase / it /
but it generates 500 and both with
RewriteRule ^ oldcategory1 / oldcategory2 / product $ https://www.sample.com/newcategory1/ ... y2 / product [L, R = 301]
and it does not work anyway.

Re: problem with redirect 301

Posted: Wed Dec 12, 2018 6:34 pm
by paulfeakins
RewriteBase /{why are you putting a space here?}it{and here?}/

Re: problem with redirect 301

Posted: Wed Dec 12, 2018 8:49 pm
by acjp
tanks for answer. i didn't put space. it is for copy and paste. with this setting i have a 500 error.

Re: problem with redirect 301

Posted: Thu Dec 13, 2018 5:15 pm
by acjp
nobody can help me?

Re: problem with redirect 301

Posted: Thu Dec 13, 2018 5:35 pm
by IP_CAM
Well, as long as you're affraid to display your REAL Shop Site URL,
here is no help !
Ernie

Re: problem with redirect 301

Posted: Thu Dec 13, 2018 8:19 pm
by acjp
I'm sorry, I didn't think it was relevant and I've always seen it done in the forum.
here is the data of the site:

Options +FollowSymlinks

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>

# 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/

RewriteCond %{HTTP_HOST} ^(www\.)?salumipasini.com$
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.salumipasini.com%{REQUEST_URI} [NC,L,R]

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) 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]

RewriteRule ^it/confezioni-speciali/tutta-la-tradizione/trezzano-sul-naviglio$ https://www.salumipasini.com/it/tutti-i ... l-naviglio [L, R = 301]

Re: problem with redirect 301

Posted: Thu Dec 13, 2018 8:45 pm
by paulfeakins
Maybe move that rule higher up in the file?