Reputation: 23
I'm trying to create a 301 redirect rule for a website I'm setting up. The old link structure is as follows:
http://www.domainname.com/projecttype/subtype/post-name
The new structure is:
http://www.domainname.com/projectname/projecttype/subtype/post-name
So basically I need to add "projectname" between domainname and projecttype. But only if there is a subfolder after projecttype. As domainname.com/projecttype/ <-- need no redirect..only redirect if a subdirectory after this exist in the url.
I've never written any regexp or redirect rules before..tried searching for something that matched my need without any luck so far :(
Upvotes: 1
Views: 607
Reputation: 143886
Try:
RedirectMatch ^/projecttype/(.+)$ /projectname/projecttype/$1
That's assuming that both project type and name are static.
Upvotes: 1