Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fix bad referer URLs [closed]

I recently notice bad URLs coming from external sites to my site.

I get a lots of 404 not found from sites that reference my site using a bad link like:

My site - http://www.example.com/mypage/CachedOnTuesdays

My link should be: http://www.example.com/mypage/

I know I cannot ask them to fix it. Is there a way for me to remove the last part of the URL to display the correct page?

like image 468
Erin Tucker Avatar asked Oct 28 '11 11:10

Erin Tucker


1 Answers

Use this:

RewriteEngine On
RewriteRule ^(.*)/CachedOnTuesdays$ http://www.example.com/$1 [R=301,NC,L]
like image 111
Tech4Wilco Avatar answered Oct 12 '22 23:10

Tech4Wilco