Search code examples
wordpress.htaccesshttp-redirecttags

Redirect Wordpress tags to homepage htaccess


I want to delete all tag product pages and I want to redirect all my wordpress product tags to homepage.

I found a lot of answers on the web and on the stackoverflow but the general answers doesn't work for me and I don't know why.

I changed the permalink in WP from tag to eticheta-produs, so my product tags looks like: https://www.domain.tld/eticheta-produs/present instead of default WP tags https://www.domain.tld/tag/present

So, I tried:

# Redirect tag 301
RewriteEngine On
RewriteRule ^eticheta-produs/(.*)$ http:/www.domain.tld/ [R=301,L]

And https:

# Redirect tag 301
RewriteEngine On
RewriteRule ^eticheta-produs/(.*)$ https:/www.domain.tld/ [R=301,L]

I stoped caching throw litespeed plugin, I tried opening tag pages throw incognito sessions of different browsers but the redirect doesn't work.


Solution

  • Try this. It will redirect anything from eticheta-produs and its subfolders to your root domain.

    RewriteEngine On
    RewriteBase /
    RedirectMatch 301 ^/eticheta-produs/(.*)$ http://domain\.tld/