0

I need to redirect all Url which contain "forums" in address bar!!

Like:http://www.sportsinjuryclinic.net/blog/forums/ to http://www.sportsinjuryclinic.net Can any one help me to do that redirection?

Thanks

2 Answers2

0

You will need to use Mod_rewrite and a regex to check for the "forums" string. Here is an example of what you're looking for. mod_rewrite rule: if URL contains a certain string

Community
  • 1
  • 1
adanot
  • 318
  • 2
  • 21
0

Rule 1:

If /blog/ is a directory then place this rule in /blog/.htaccess:

RewriteEngine On
RewriteBase /blog/

RewriteRule ^forums(/.*)?$ / [L,NC,R=302]

Rule 2:

For handling /forums/ place this rule inDocuementRoot/.htaccess`:

RewriteEngine On

RewriteRule ^forums(/.*)?$ / [L,NC,R=302]

Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.

anubhava
  • 761,203
  • 64
  • 569
  • 643