0

I have recently ported my blog from one cms to wordpress so I was having trouble in redirect the tag URL which are like this

http://site.com/blog/tag/tagname/foobar

Here "tagname" is the name of tag created using WordPress
and "foobar" can be any string

I want it to redirect permanently (301) it to

http://site.com/blog/index.php/tagname/

such that that string after the tag name i.e "foobar" is truncated and "index.php" is added in-between.

I know there are many posts regarding .htaccess but i don't know much about its syntax except basics rules. So i was unable to comprehend the specific solutions given on other questions to apply them to my problem.

Atheist
  • 525
  • 3
  • 22
Shivam Mathur
  • 2,543
  • 19
  • 26

1 Answers1

3

This should do it:

RewriteEngine on
#redirects from http://site.com/blog/tag/{tagname}/foobar to http.//site.com/blog/index.php/{tagname}
RewriteRule ^/blog/tag/([a-zA+])/[a-zA-Z]+$ /blog/index.php/$1/ [R=301,L]
Atheist
  • 525
  • 3
  • 22