Hirak
Hirak

Reputation: 15

htaccess URL wrong redirection

I want to redirect

All these pages should be redirected to about.html and I want to do this with .htaccess.

I wast trying by

RewriteRule ^(about|weare).*/ about.html [R=Permanent]

This is somewhat working, but not exactly what I want. It is also redirecting some other pages.

I have added as said by ThinkingMonkey

If you want to do a permanent redirect:

    RewriteCond %{REQUEST_URI} !^/about\.html$ [NC]
    RewriteRule ^(about|weare)(\.html)?/?$ about.html [L,R=301]

This is working But it is going for infinite loop.

Upvotes: 0

Views: 139

Answers (2)

CyrillC
CyrillC

Reputation: 557

RewriteRule ^((about|weare)(.|/)?(html)?) about.html [NC]

Upvotes: 0

ThinkingMonkey
ThinkingMonkey

Reputation: 12727

Do this:

RewriteRule ^(about|weare)(/|\.html/?)?$ about.html [L]

If you want to do a permanent redirect:

RewriteCond %{REQUEST_URI} !^/about\.html$ [NC]
RewriteRule ^(about|weare)(\.html)?/?$ about.html [L,R=301]

Upvotes: 1

Related Questions