I’m trying to do a 301 redirect using .htaccess file to redirect:
Target URL:
https://blanee.com/punaises-de-lit/punaises-de-lit-peau-de-mue/bpage/2000/
and after Redirection the URL :
https://blanee.com/punaises-de-lit/punaises-de-lit-peau-de-mue
I want to remove /bpage/2000/
that string from the URL.
NOTE: /2000/
this is an integer number, 1-2000 or more than more numbers in the URL, this random number, That I want to fetch.
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{QUERY_STRING} ^/bpage/([a-zA-Z])$
RewriteRule ^index.php$ /knowledgebase/ [L,R=301]
</IfModule>
# END WordPress
I have that code already uses in my WordPress
2
Answers
This is worked for me. Put this at the top of your .htaccess just below the line that says
RewriteEngine on
.You can use this in your htaccess :
Put this at the top of your htaccess just below the line that says
RewriteEngine on
.