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 :(
Try:
RedirectMatch ^/projecttype/(.+)$ /projectname/projecttype/$1
That's assuming that both project type and name are static.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.