shadab.tughlaq
shadab.tughlaq

Reputation: 454

Adding Exception in htaccess RedirectMatch

I need to exclude the link /en/create/news to this rule

RedirectMatch 301 ^/[A-Za-z]{2}/([A-Za-z0-9,_.-]+)/news$ http://example.com/news/$1/news

I Tried

RedirectMatch 301 ^/[A-Za-z]{2}/([A-Za-z0-9,_.-]+!(create))/news$ http://example.com/news/$1/news

Did not work. Please suggest

Upvotes: 0

Views: 75

Answers (1)

Croises
Croises

Reputation: 18671

You can use instead :

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^/en/create/ [NC]
RewriteRule ^[a-z]{2}/([a-z0-9,_.-]+)/news$ http://example.com/news/$1/news [NC,R=301,L]

Or if you try to exclude /create/ for all languages:

RewriteCond %{REQUEST_URI} !^/[a-z]{2}/create/ [NC]

Upvotes: 1

Related Questions