Reputation: 394
Am trying to create a rewrite rule and struggling from couple of days.
My condition should be in such a way that if in the url after authorbio ONLY ONE WORD is found then leave it as it is. for all remaining conditions it should remove authorbio/
The conditions 2 & 3 in below example are generic and can be done easily but it should be done along with condition#1 in example
Example:
THIS SHOULD REMAIN AS IT IS:
/mainblog/authorbio/authorname
SHOULD BE CHANGED TO
/mainblog/authorbio/authorname
WHERE AS THIS SHOULD REMOVE AUTHORBIO FROM THE URL
/mainblog/authorbio/someblog/blogarticle
SHOULD BE CHANGED TO
/mainblog/someblog/blogarticle
Also THIS SHOULD REMOVE AUTHORBIO FROM THE URL
/mainblog/authorbio/
SHOULD BE CHANGED TO
/mainblog
Upvotes: 1
Views: 128
Reputation: 784898
Place this rule in /mainblog/.htaccess
:
RewriteEngine On
RewriteBase /mainblog/
RewriteRule ^authorbio/?$ /mainblog/ [NC,L,R]
RewriteRule ^authorbio/([^/]+/.+)$ $1 [NC,L,R]
Upvotes: 1