PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, March 16, 2022

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

 March 16, 2022     .htaccess, lamp, mod-rewrite, url-rewriting, wordpress     No comments   

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
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing