Redirecting "Bad Word" URLs

Using mod_rewrite to handle various content issues

Redirecting "Bad Word" URLs

Postby jazzylee » Fri Jun 27, 2008 6:03 am

This is for a section of a site that features on topic videos from Youtube. Unfortunately,the script will also display off topic vids and even adult content through the tags or searches. So there is a break of the adsense TOS.

I could remove the tags and search, but the pages could still be accessed from search indexes etc.

So I'm wondering if there is a way to redirect URLs that contain words from a list?

lets say mysite.com/video-area/tag/bad-word displays thumbnails and links to video pages like mysite.com/video-area/tag/bad-word/i_qfdTP-_co/_bad-word__Party
jazzylee
 
Posts: 12
Joined: Tue Apr 10, 2007 2:11 pm

Postby richardk » Sat Jun 28, 2008 4:09 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^video-area/tags/(bad|word|list)(/.*)?$ /somewhere [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jazzylee » Sun Jun 29, 2008 5:53 am

Thanks for the help. That works for exact match of specific words inserted in the url. I'm hoping to rewrite urls that contain those words.

Like using a list (fraz|razmit|frickin)

would rewrite urls like

video-area/tags/frickin-fraz
video-area/tags/red-fraz
video-area/tags/intense_razmit
video-area/tags/sillyfraz
video-area/tags/frazfrazfraz
jazzylee
 
Posts: 12
Joined: Tue Apr 10, 2007 2:11 pm

Postby richardk » Mon Jun 30, 2008 12:11 pm

Then you need
Code: Select all
^video-area/tags/[^/]*(bad|word|list)[^/]*(/.*)?$
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jazzylee » Mon Jun 30, 2008 6:41 pm

cool, thanks so much! It's a bit heavy handed way to handle the problem, also killing words with badwords embedded in them, but it works fine for this situation. (don't need any documentaries about Sussex) Hopefully Google will agree...
jazzylee
 
Posts: 12
Joined: Tue Apr 10, 2007 2:11 pm

Postby jazzylee » Mon Jun 30, 2008 6:53 pm

Now how can This be changed to cover case variations? BaD wOrD
jazzylee
 
Posts: 12
Joined: Tue Apr 10, 2007 2:11 pm

Postby richardk » Tue Jul 01, 2008 3:37 pm

Code: Select all
[NC,R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jazzylee » Thu Jul 03, 2008 10:50 am

Great! This and other measures really cleans up a lot of the unintended adult content.
jazzylee
 
Posts: 12
Joined: Tue Apr 10, 2007 2:11 pm


Return to Content

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron