Wednesday, March 16, 2022

[FIXED] Redirect all urls that contain /content/ to home page using htaccess

Issue

I want to redirect all urls which has www.example.com/content/xyz... to home www.example.com

The condition here is to check, if the request contains /content/ then only I need to redirect it to root level domain.

The site is hosted on Linux Server, and build using wordpress.

How can I do this using htaccess rewrite rules?


Solution

Yo may try this:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^.*/content.*$
RewriteRule .*  /     [L,R=301,DPI]


Answered By - Felipe Alameda A

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.