Mahesh Budeti
Mahesh Budeti

Reputation: 394

Rewrite URL on specific condition only

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:

Upvotes: 1

Views: 128

Answers (1)

anubhava
anubhava

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

Related Questions