Forum Moderators: phranque

Message Too Old, No Replies

Tricky regexp

w(eight?loss)

         

Marino

1:51 pm on Apr 1, 2005 (gmt 0)

10+ Year Member



Hello

I've a problem with a regexp. In my htaccess file, I've got a series of keywords dedicated to modern chemistry :

#-------------------------------------------------------------------------------
RewriteCond %{HTTP_REFERER} a(dipex¦llegra¦mbien¦nabolic¦tivan) [NC,OR]
RewriteCond %{HTTP_REFERER} b(ontril) [NC,OR]
RewriteCond %{HTTP_REFERER} d(iabete¦iazepam¦didrex) [NC,OR]
RewriteCond %{HTTP_REFERER} c(elebrex¦ialis¦lonazepam¦odeine) [NC,OR]
RewriteCond %{HTTP_REFERER} f(lonase) [NC,OR]
RewriteCond %{HTTP_REFERER} h(ydrocodone) [NC,OR]
RewriteCond %{HTTP_REFERER} i(onamin¦iposuction) [NC,OR]
RewriteCond %{HTTP_REFERER} l(evitra¦ipitor¦orazepam) [NC,OR]
RewriteCond %{HTTP_REFERER} m(assage¦eridia¦orphine) [NC,OR]
RewriteCond %{HTTP_REFERER} n(ursing) [NC,OR]
RewriteCond %{HTTP_REFERER} p(axil¦harmacies¦harmacy¦hentermine¦hendimetrazin¦heromone¦rescription¦ropecia¦rozac) [NC,OR]
RewriteCond %{HTTP_REFERER} r(italin¦ivotril) [NC,OR]
RewriteCond %{HTTP_REFERER} s(urgery) [NC,OR]
RewriteCond %{HTTP_REFERER} t(ramadol) [NC,OR]
RewriteCond %{HTTP_REFERER} u(ltram) [NC,OR]
RewriteCond %{HTTP_REFERER} v(alium¦altr ?ex¦iagra¦icodin¦ioxx) [NC,OR]
#RewriteCond %{HTTP_REFERER} w(eight ?loss) [NC,OR]
RewriteCond %{HTTP_REFERER} x(anax¦enical) [NC,OR]
RewriteCond %{HTTP_REFERER} z(oloft¦yban¦yrtec)
RewriteRule ^(.*)$ %1 [R=301,L]

I've had to comment a line for a regexp would always issue an error 500 :

#RewriteCond %{HTTP_REFERER} w(eight ?loss) [NC,OR]

Strange. I guess the regexp is ok. I've tried the following one, and it would not work either:

#RewriteCond %{HTTP_REFERER} w(eight *loss) [NC,OR]

Why? I tried them on several regexp engines, and it was ok...

jdMorgan

4:01 pm on Apr 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't have an unescaped space in mod_rewrite regex. Use "w(eight\?loss"

Jim

Marino

6:19 pm on Apr 1, 2005 (gmt 0)

10+ Year Member



Thaaaaanx.