Jump to content
driven22

redirect 301 problem - adds at the end ?product=..

Recommended Posts

Hi,

I have problem with redirect 301 in my shop (frozen version).

In htaacess i was add ex. Redirect 301 /sok-z-pokrzywy-250ml-niepasteryzowany-na-anemie-zelazo-p-39.html https://www.kuzdrowiu.com.pl/sok-z-pokrzywy-250ml-niepasteryzowany-p-39.html

When i click on link (or write) https://www.kuzdrowiu.com.pl/sok-z-pokrzywy-250ml-niepasteryzowany-na-anemie-zelazo-p-39.html he adds on the and ?products_id=39&products_id=39

After redirect the link should  look like this: https://www.kuzdrowiu.com.pl/sok-z-pokrzywy-250ml-niepasteryzowany-p-39.html  (wihout any ?product=... after link) 

Where is the problem ? Please, help me.

 

Share this post


Link to post
Share on other sites

Can you put the actual line from the .htaccess file?  Presumably you have something like [R] in it.  That probably needs to have an L added.  [R, L] but it may have other stuff too. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
<IfModule mod_rewrite.c>
 # Begin Ultimate SEO V2.2d
Options +FollowSymLinks
RewriteEngine On

RewriteBase /

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-po-([0-9]+).html$ pollbooth.php?pollid=$2&%{QUERY_STRING}



   RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.mypage.com.pl$
RewriteRule ^(.*)$ https://www.mypage.com.pl/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php [NC]
RewriteRule ^index\.php$ https://www.mypage.com.pl/ [R=301,L]



    AddDefaultCharset UTF-8
  
Redirect 301 /contact_us.php https://www.mypage.com.pl/kontakt.php
Redirect 301 /sok-z-pokrzywy-250ml-niepasteryzowany-na-anemie-zelazo-p-39.html https://www.mypage.com.pl/sok-z-pokrzywy-250ml-niepasteryzowany-p-39.html
Redirect 301 /sok-z-przywrotnika-250ml-p-57.html https://www.mypage.com.pl/przywrotnik-250ml-ze-swiezego-ziela-p-57.html
Redirect 301 /arcydziegiel-nalewka-na-kaszel-p-52.html https://www.mypage.com.pl/arcydziegiel-korzen-250ml-p-52.html
Redirect 301 /przywrotnik-pospolity-sok-100-ml-p-41.html https://www.mypage.com.pl/przywrotnik-250ml-ze-swiezego-ziela-p-57.html


</IfModule>
  <IfModule mod_headers.c>
# Set XSS Protection header
Header set X-XSS-Protection "1; mode=block"
</IfModule>
<IfModule mod_headers.c>
  Header unset ETag
</IfModule>
FileETag None

## EXPIRES CACHING ##
## https://gtmetrix.com/leverage-browser-caching.html ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

My htaccess looks like this. It always adds ?product=xx  for 301 redirection

Share this post


Link to post
Share on other sites

I would suggest trying the following: 

Remove

Redirect 301 /contact_us.php https://www.mypage.com.pl/kontakt.php
Redirect 301 /sok-z-pokrzywy-250ml-niepasteryzowany-na-anemie-zelazo-p-39.html https://www.mypage.com.pl/sok-z-pokrzywy-250ml-niepasteryzowany-p-39.html
Redirect 301 /sok-z-przywrotnika-250ml-p-57.html https://www.mypage.com.pl/przywrotnik-250ml-ze-swiezego-ziela-p-57.html
Redirect 301 /arcydziegiel-nalewka-na-kaszel-p-52.html https://www.mypage.com.pl/arcydziegiel-korzen-250ml-p-52.html
Redirect 301 /przywrotnik-pospolity-sok-100-ml-p-41.html https://www.mypage.com.pl/przywrotnik-250ml-ze-swiezego-ziela-p-57.html

And before

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}

add

RewriteRule ^contact_us.php$ kontakt.php [R=301,L]
RewriteRule ^sok-z-pokrzywy-250ml-niepasteryzowany-na-anemie-zelazo-p-39.html$ sok-z-pokrzywy-250ml-niepasteryzowany-p-39.html [R=301,L]
RewriteRule ^sok-z-przywrotnika-250ml-p-57.html$ przywrotnik-250ml-ze-swiezego-ziela-p-57.html [R=301,L]
RewriteRule ^arcydziegiel-nalewka-na-kaszel-p-52.html$ arcydziegiel-korzen-250ml-p-52.html [R=301,L]
RewriteRule ^przywrotnik-pospolity-sok-100-ml-p-41.html$ przywrotnik-250ml-ze-swiezego-ziela-p-57.html [R=301,L]

I think that mixing the two modules is causing issues. 

As always, you should make a copy of the current .htaccess before making changes, just in case this makes it worse in some way. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
Unfortunately it is the same. In the case of a link:
https://www.kuzdrowiu.com.pl/przywrotnik-pospolity-sok-100-ml-p-41.html

  it shows something like this:

https://www.kuzdrowiu.com.pl/-p-41.html
 
in other cases, when the product has the same id but only the address has changed, it adds at the end ?product_id= ...

example:

redirect from .... /sok-z-pokrzywy-250ml-niepasteryzowany-na-anemie-zelazo-p-39.html

it shows:

https://www.kuzdrowiu.com.pl/sok-z-pokrzywy-250ml-niepasteryzowany-p-39.html?products_id=39
 
Maybe it's the seo urls module's fault?

 

Share this post


Link to post
Share on other sites
I moved 301 before:
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
and redirections that have the same id as before redirecting, works fine. Unfortunately, the redirection from the product ex. ID 41 to ex. ID 52 does not work yet. Here it still adds ?product_id=..
..../przywrotnik-250ml-ze-swiezego-ziela-p-52.html?products_id=41

 

Share this post


Link to post
Share on other sites
2 minutes ago, driven22 said:

I moved 301 before:

Did you change them from mod_alias redirects to mod_rewrite redirects?  Because mod_rewrite will always run before mod_alias, regardless of where the directives are placed in the file.  See https://wordpress.stackexchange.com/a/309085 for more discussion. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
After 4 hours it suddenly started working as it should on all computers. Thank you very much for your help :)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×