Cesar Bielich
Cesar Bielich

Reputation: 4945

RewriteRule not triggering 404 and not 410 error

RewriteEngine On
RewriteBase /    
RewriteRule ^http:\/\/www.example.com\/word-lists\/words-that-end-with\/letter\/[a-z0-9]{2,}$ [NC,R=410,L]

DEMO

I have checked my htaccess file and there is nothing in there that would override this rule that I can see. For some reason pages that should trigger this rule are not and sending me to a 404 instead.

Example Trigger URL: http://www.example.com/word-lists/words-that-end-with/letter/hdfdf

Do I need a RewriteCond Rule before this?

Upvotes: 1

Views: 104

Answers (2)

Aung Myo Linn
Aung Myo Linn

Reputation: 2890

If you want to return 410 instead, then use [G] flag

RewriteEngine On
RewriteBase / 
RewriteRule ^word-lists/words-that-end-with/letter/[a-z0-9]{2,}$ - [G]

Upvotes: 2

Amit Verma
Amit Verma

Reputation: 41219

Remove the HTTP_HOST from your.

RewriteEngine On
RewriteBase /    
RewriteRule ^/?word-lists/words-that-end-with/letter/[a-z0-9]{2,}$ - [NC,R=410,L]

Upvotes: 2

Related Questions