JSmits
JSmits

Reputation: 13

RewriteCond: Bad flag delimitor in my .htaccess

I kinda need your help. I suddenly got website 500 error on my company's website. I have taken my complete code and put it through htaccesscheck.com.

It narrowed it down to line 290 in my .htaccess file.

The line is:

RewriteCond %{HTTP_USER_AGENT} !(android|blackberry9500|blackberry9530|cupcake|dream|incognito|iphone|ipod|mini|webOS|webmate|2.0 MMP|ASUS|AU-MIC|Alcatel|Amoi|Audiovox|AvantGo|BenQ|Bird|BlackBerry|Blazer|CDM|Cellphone|DDIPOCKET|Danger|DoCoMo|Elaine/3.0|Ericsson|EudoraWeb|Fly|HP.iPAQ|Haier|Huawei|IEMobile|J-PHONE|KDDI|KONKA|KWC|KYOCERA/WX310K|LG|LG/U990|Lenovo|MIDP-2.0|MMEF20|MOT-V|MobilePhone|Motorola|NEWGEN|NetFront|Newt|Nintendo Wii|Nitro|Nokia|Novarra|O2|Opera Mini|Opera.Mobi|PANTECH|PDXGW|PG|PPC|PT|Palm|Panasonic|Philips|Playstation Portable|ProxiNet|Proxinet|Qtek|SCH|SEC|SGH|SHARP-TQ-GX10|SIE|SPH|Sagem|Samsung|Sanyo|Sendo|Sharp|Small|Smartphone|SoftBank|SonyEricsson|Symbian|Symbian OS|SymbianOS|TS21i-10|Toshiba|Treo|UP.Browser|UP.Link|UTS|Vertu|WILLCOME|WinWAP|Windows CE|Windows.CE|Xda|ZTE|dopod|hiptop|htc|i-mobile|nokia|portalmmm|vodafone|ipad) [NC]

Which gives this error: RewriteCond: bad flag delimiters

As i am not very experienced in coding, i have not been able to detect the fault yet.

If there is anyone who can help me on this matter, it would be greatly appreciated.

-Jasper

Upvotes: 1

Views: 44

Answers (1)

Croises
Croises

Reputation: 18671

Use:

RewriteCond %{HTTP_USER_AGENT} !"(android|blackberry9500|blackberry9530|cupcake|dream|incognito|iphone|ipod|mini|webOS|webmate|2.0 MMP|ASUS|AU-MIC|Alcatel|Amoi|Audiovox|AvantGo|BenQ|Bird|BlackBerry|Blazer|CDM|Cellphone|DDIPOCKET|Danger|DoCoMo|Elaine/3.0|Ericsson|EudoraWeb|Fly|HP.iPAQ|Haier|Huawei|IEMobile|J-PHONE|KDDI|KONKA|KWC|KYOCERA/WX310K|LG|LG/U990|Lenovo|MIDP-2.0|MMEF20|MOT-V|MobilePhone|Motorola|NEWGEN|NetFront|Newt|Nintendo Wii|Nitro|Nokia|Novarra|O2|Opera Mini|Opera.Mobi|PANTECH|PDXGW|PG|PPC|PT|Palm|Panasonic|Philips|Playstation Portable|ProxiNet|Proxinet|Qtek|SCH|SEC|SGH|SHARP-TQ-GX10|SIE|SPH|Sagem|Samsung|Sanyo|Sendo|Sharp|Small|Smartphone|SoftBank|SonyEricsson|Symbian|Symbian OS|SymbianOS|TS21i-10|Toshiba|Treo|UP.Browser|UP.Link|UTS|Vertu|WILLCOME|WinWAP|Windows CE|Windows.CE|Xda|ZTE|dopod|hiptop|htc|i-mobile|nokia|portalmmm|vodafone|ipad)" [NC]

With "
Or encode space as \. ex: 2\.0\ MMP

Upvotes: 2

Related Questions