Thanks in advance for helping me. I am new here and also new to redirect rules. I have an issue after .htaccess 301 redirect I did on my website url's.
- First, the URLs slugs were with "_" (underscore).
- 2nd, I change URL's structure from "_" to "-" (hyphen).
- I now did .htaccess 301 redirects from old URL to the new URLs.
ISSUE: when I redirect the URL, and try to click my URL from google search it worked, but with extra slugs (?promo/sports_and_outdoors_coupons=23&hta&ext=
) in the URLS.
Here is my .htaccess code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)(\-(\d+))?([.]\w+|\/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
Redirect 301 /promo/auto_parts-26 /promo/auto-parts-26
Redirect 301 /promo/bath__body-27 /promo/bath--body-27
Redirect 301 /promo/computers_and_electronics-8 /promo/computers-and-electronics-8
Redirect 301 /promo/health__wellness-13 /promo/health--wellness-13
Redirect 301 /promo/home_and_garden-14 /promo/home-and-garden-14
Redirect 301 /promo/musical_instruments-16 /promo/musical-instruments-16
Redirect 301 /promo/office_supplies-17 /promo/office-supplies-17
Redirect 301 /promo/party_supplies-18 /promo/party-supplies-18
After clicking url from google search, this is the permanlink on my website:
https://website.com/promo/auto-parts-26?promo/auto_parts_26=26&hta&ext=
I need quick fix, would you kindly help, what I am doing wrong. thank you.
Main issue occurring from this part
RewriteRule ^(.*?)(\-(\d+))?([.]\w+|\/)?$ index.php?$1=$3&hta&ext=$4 [QSA,L]
I removed it, url redirect correctly, but page was not loading. url not found error.