0

Moved web site from apache 2.2 to 2.4.9 and got this error on log file:

/public_html/.htaccess: RewriteRule: cannot compile regular expression '^encyclopedia-terms([0-9]*)-([a-zA-Z0-9_-?\xa7?a2?\xa8U\xbe???\xab?\xac?\x86?\xad?\xae?\xaf?\xb0?\xb1?\xb2???\xb3?\xb4?\xb5?\xb6?\xb7?\xb8?\xb9??U?U\x82U\x83?\xa9?\xafU\x84U\x85U\x86U\x88U\x87U\x8cU?]*).html',

Error on browser is:
The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at webmaster@domain to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

#####################################  Start htaccess sec code
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
<Files config.php>
order allow,deny
deny from all
</Files>
#####################################  end htaccess sec code
<IFModule mod_rewrite.c>
RewriteEngine on
#####################################  Start Set Your Path
RewriteBase /
#####################################  End Set Your Path
#####################################  Start Injection/xss/Agent Blocking
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(;|<|>|�|�|\)|%0A|%0D|%22|%27|%3C|%3E|).*(/\*|union|concat).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Anarchie [OR]
RewriteCond %{HTTP_USER_AGENT} ^ASPSeek [OR]
RewriteCond %{HTTP_USER_AGENT} ^attach [OR]
RewriteCond %{HTTP_USER_AGENT} ^autoemailspider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xenu [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule ^.* - [F,L]
#####################################  End Injection/xss Blocking
RewriteRule ^index.html index.php
#Articles
RewriteRule ^article-([0-9]*)-([a-z]*)-([0-9]*)-([0-9]*).html modules.php?name=News&file=article-seo&sid=$1&mode=$2&order=$3&thold=$4
RewriteRule ^article-([0-9-]*)-([a-z]*)-([0-9]*)-([0-9]*).html([0-9#]*) modules.php?name=News&file=article-seo&thold=$1&mode=$2&order=$3&sid=$4$5
RewriteRule ^article-topic([0-9]*)-page([0-9]*).html modules.php?name=News&new_topic=$1&page=$2
RewriteRule ^article-category([0-9]*)-page([0-9]*).html modules.php?name=News&file=categories&op=newindex&catid=$1&page=$2
RewriteRule ^article-category-([0-9]*).html modules.php?name=News&file=categories&op=newindex&catid=$1
RewriteRule ^article-print-([0-9]*).html modules.php?name=News&file=print&sid=$1
RewriteRule ^article-friend-([0-9]*).html modules.php?name=News&file=friend&op=FriendSend&sid=$1
RewriteRule ^article-page-([0-9]*).html modules.php?name=News&page=$1
RewriteRule ^article([1-9][0-9]*).* modules.php?name=News&file=article-seo&sid=$1 [L]
RewriteRule ^([0-9]*)-([a-z]*) modules.php?name=News&file=article-seo&sid=$1  
RewriteRule ^([0-9]*)/([a-z]*) modules.php?name=News&file=article-seo&sid=$1  
#RewriteRule ^/([^/]*)\([1-9][0-9]*)  modules.php?name=News&file=article-seo&sid=$1  [L]
RewriteRule ^article-topic-([0-9]*).html modules.php?name=News&new_topic=$1 
RewriteRule ^t-([1-9][0-9]*)-([^/]*).html modules.php?name=News&new_topic=$1
RewriteRule ^allnews.html modules.php?name=News&file=allindex
RewriteRule ^news.html modules.php?name=News

RewriteRule ^tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*)/page/([0-9]*)/ modules.php\?name=News&file=tags&tags=$1&page=$2
RewriteRule ^tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*)/page/([0-9]*) modules.php\?name=News&file=tags&tags=$1&page=$2
RewriteRule ^tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*)/ modules.php?name=News&file=tags&tags=$1
RewriteRule ^tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*) modules.php?name=News&file=tags&tags=$1


#Products
RewriteRule ^Products-([0-9]*)-([a-z]*)-([0-9]*)-([0-9]*).html modules.php?name=Products&file=product&sid=$1&mode=$2&order=$3&thold=$4
RewriteRule ^Products-([0-9-]*)-([a-z]*)-([0-9]*)-([0-9]*).html([0-9#]*) modules.php?name=Products&file=product&thold=$1&mode=$2&order=$3&sid=$4$5
RewriteRule ^Products-topic([0-9]*)-page([0-9]*).html modules.php?name=Products&new_topic=$1&page=$2
RewriteRule ^Products-category([0-9]*)-page([0-9]*).html modules.php?name=Products&file=categories&op=newindex&catid=$1&page=$2
RewriteRule ^Products-category-([0-9]*).html modules.php?name=Products&file=categories&op=newindex&catid=$1
RewriteRule ^Products-print-([0-9]*).html modules.php?name=Products&file=print&sid=$1
RewriteRule ^Products-friend-([0-9]*).html modules.php?name=Products&file=friend&op=FriendSend&sid=$1
RewriteRule ^Products-page-([0-9]*).html modules.php?name=Products&page=$1
RewriteRule ^Products-([1-9][0-9]*).* modules.php?name=Products&file=product&sid=$1 [L]
RewriteRule ^Products-([0-9]*)-([a-z]*) modules.php?name=Products&file=product&sid=$1  
RewriteRule ^Products/([0-9]*)/([a-z]*) modules.php?name=Products&file=product&sid=$1  
#RewriteRule ^/([^/]*)\([1-9][0-9]*)  modules.php?name=Products&file=product&sid=$1  [L]
RewriteRule ^Products-topic-([0-9]*).html modules.php?name=Products&new_topic=$1 
RewriteRule ^Products-t-([1-9][0-9]*)-([^/]*).html modules.php?name=Products&new_topic=$1
RewriteRule ^allProducts.html modules.php?name=Products&file=allindex
RewriteRule ^Products.html modules.php?name=Products
RewriteRule ^Good-([0-9]*).html modules.php?name=cart&op=addgood&gdn=$1
RewriteRule ^Products-tags-([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*).html modules.php?name=Products&file=tags&tags=$1
RewriteRule ^Products-tags-([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*)-([0-9]*).html modules.php?name=Products&file=tags&tags=$1&page=$2
RewriteRule ^Products/tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*) modules.php?name=Products&file=tags&tags=$1
RewriteRule ^Products/tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*)/([0-9]*) modules.php?name=Products&file=tags&tags=$1&page=$2



#AvantGo
RewriteRule ^avantgo-print-([0-9]*).html modules.php?name=AvantGo&file=print&sid=$1
RewriteRule ^avantgo.html modules.php?name=AvantGo

#Content
RewriteRule ^content-([0-9]*)-page([0-9]*).html modules.php?name=Content&file=content&op=showpage&pid=$1&page=$2
RewriteRule ^content-cat-([0-9]*).html modules.php?name=Content&file=topic&op=list_pages_categories&cid=$1
RewriteRule ^content-([0-9]*).html modules.php?name=Content&file=content&op=showpage&pid=$1
RewriteRule ^content-([0-9]*)-ok.html modules.php?name=Content&file=content&op=showpage&pid=$1&ok=1
RewriteRule ^content-topics.html modules.php?name=Content&file=topic
RewriteRule ^content-topic-([0-9]*).html modules.php?name=Content&file=index&new_cat=$1
RewriteRule ^content-tags-([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*).html modules.php?name=Content&file=tags&tags=$1
RewriteRule ^content-tags-([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*)-([0-9]*).html modules.php?name=Content&file=tags&tags=$1&page=$2
RewriteRule ^content/tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*) modules.php?name=Content&file=tags&tags=$1
RewriteRule ^content/tags/([a-zA-Z0-9_.-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*)/([0-9]*) modules.php?name=Content&file=tags&tags=$1&page=$2
RewriteRule ^content.html modules.php?name=Content

#Downloads
RewriteRule ^downloadview-(comments|details|editorial)-([0-9]*)-([[:punct:]/:\-\'{}()._&a-zA-Z0-9+=]*).html modules.php?name=Downloads&d_op=viewdownload$1&lid=$2&ttitle=$3
RewriteRule ^download-mod-([0-9]*).html modules.php?name=Downloads&d_op=modifydownloadrequest&lid=$1
RewriteRule ^download-broken-([0-9]*).html modules.php?name=Downloads&d_op=brokendownload&lid=$1
RewriteRule ^download-shownew-([0-9]*).html modules.php?name=Downloads&d_op=NewDownloads&newdownloadshowdays=$1
RewriteRule ^download-seldate-([a-zA-Z0-9+]*).html modules.php?name=Downloads&d_op=NewDownloadsDate&selectdate=$1
RewriteRule ^download-file-([0-9]*).html modules.php?name=Downloads&d_op=getit&lid=$1
RewriteRule ^ratedownload-([0-9]*)-([[:punct:]/:\-\'{}()._&a-zA-Z0-9+=]*).html modules.php?name=Downloads&d_op=ratedownload&lid=$1&ttitle=$2
RewriteRule ^ratedownload-([0-9]*).html modules.php?name=Downloads&d_op=ratedownload&lid=$1
RewriteRule ^download-(TopRated|MostPopular)-([0-9]*)-(num|percent).html modules.php?name=Downloads&d_op=$1&ratenum=$2&ratetype=$3
RewriteRule ^downloads-(AddDownload|NewDownloads|MostPopular|TopRated).html modules.php?name=Downloads&d_op=$1
RewriteRule ^download([0-9]*)-orderby([a-zA-Z0-9+]*).html modules.php?name=Downloads&d_op=viewdownload&cid=$1&orderby=$2
RewriteRule ^download([0-9]*)-([0-9]*)-([a-zA-Z0-9+]*)-([0-9]*).html modules.php?name=Downloads&d_op=viewdownload&cid=$1&min=$2&orderby=$3&show=$4
RewriteRule ^download-search-([[:punct:]/:\-\'{}()._&a-zA-Z0-9+=]*)-([0-9]*)-([a-zA-Z0-9+]*)-([0-9]*).html modules.php?name=Downloads&d_op=search&query=$1&min=$2&orderby=$3&show=$4
RewriteRule ^download-search-([[:punct:]/:\-\'{}()._&a-zA-Z0-9+=]*)-([a-zA-Z0-9+]*).html modules.php?name=Downloads&d_op=search&query=$1&orderby=$2
RewriteRule ^download-search-([[:punct:]/:\-\'{}()._&a-zA-Z0-9+=]*).html modules.php?name=Downloads&d_op=search&query=$1
RewriteRule ^download-outside-([0-9]*).html modules.php?name=Downloads&d_op=outsidedownloadsetup&lid=$1
RewriteRule ^downloads-cat([0-9]*).html modules.php?name=Downloads&d_op=viewdownload&cid=$1
RewriteRule ^downloads.html modules.php?name=Downloads

#Encyclopedia
RewriteRule ^encyclopedia-([0-9]*)-page([0-9]*)-([a-zA-Z0-9_-]*).html modules.php?name=Encyclopedia&op=content&tid=$1&page=$2&query=$3
RewriteRule ^encyclopedia-([0-9]*)-page([0-9]*).html modules.php?name=Encyclopedia&op=content&tid=$1&page=$2
RewriteRule ^encyclopedia-([0-9]*)-([a-zA-Z0-9_-]*).html modules.php?name=Encyclopedia&op=content&tid=$1&query=$2
RewriteRule ^encyclopedia-([0-9]*).html modules.php?name=Encyclopedia&op=content&tid=$1
RewriteRule ^encyclopedia-list-([0-9]*).html modules.php?name=Encyclopedia&op=list_content&eid=$1
RewriteRule ^encyclopedia-terms([0-9]*)-([a-zA-Z0-9_-اآبپتثجچحخدذرزژسشصضطظعغÙقكکگلمنوهیي]*).html modules.php?name=Encyclopedia&op=terms&eid=$1&ltr=$2
RewriteRule ^encyclopedia-search-([a-zA-Z0-9_-]*).html modules.php?name=Encyclopedia&file=search&query=$1
RewriteRule ^encyclopedia-search.html modules.php?name=Encyclopedia&file=search
RewriteRule ^encyclopedia.html modules.php?name=Encyclopedia

#Feedback
RewriteRule ^feedback.html modules.php?name=Feedback

#FAQ
RewriteRule ^faq.html modules.php?name=FAQ
RewriteRule ^faq-([0-9]*)-([a-zA-Z0-9\+\&\-\/%[:punct:]\.\;]*).html modules.php?name=FAQ&myfaq=yes&id_cat=$1&categories=$2

#Forums
RewriteRule ^ftopicp-([0-9]*).html /Forum/viewtopic.php?p=$1 [R=301,L]
RewriteRule ^ftopict-([0-9]*).html /Forum/viewtopic.php?t=$1 [R=301,L]
RewriteRule ^modules.php?name=Forums&file=viewtopic&p=([0-9]*) /Forum/viewtopic.php?p=$1 [R=301,L]
RewriteRule ^modules.php?name=Forums&file=viewtopic&t=([0-9]*) /Forum/viewtopic.php?t=$1 [R=301,L]

#Journal
RewriteRule ^journal-search-([a-zA-Z0-9]*).html modules.php?name=Journal&file=searchbywhat=aid&exact=1&forwhat=$1
RewriteRule ^journal(search|delete|commentkill)-(bywhat|jid|onwhat)([a-zA-Z0-9]*)-(forwhat|ref)([a-zA-Z0-9]*).html modules.php?name=Journal&file=$1&$2=$3&$4=$5
RewriteRule ^journal-search-([0-9]*)-([a-zA-Z0-9_-]*).html modules.php?name=Journal&file=search&bywhat=$1&forwhat=$2
RewriteRule ^journal-([a-zA-Z0-9+]*)-(jid|onwhat|disp|op|disp)-([a-zA-Z0-9+]*).html modules.php?name=Journal&file=$1&$2=$3
RewriteRule ^journal-edit.html modules.php?name=Journal&file=edit
RewriteRule ^journal(file|op)-([a-zA-Z0-9]*).html modules.php?name=Journal&$1=$2
RewriteRule ^journal.html modules.php?name=Journal

#Members List
RewriteRule ^members.html modules.php?name=Members_List

#Private Messages
RewriteRule ^messages-post-([0-9]*).html modules.php?name=Private_Messages&file=index&mode=post&u=$1
RewriteRule ^messages-post-([0-9]*).html modules.php?name=Private_Messages&mode=post&u=$1
RewriteRule ^messages-new.html modules.php?name=Private_Messages&file=index&mode=post
RewriteRule ^messages-(sentbox|inbox|savebox|outbox).html modules.php?name=Private_Messages&file=index&folder=$1
RewriteRule ^messages.html modules.php?name=Private_Messages

#Recommend Us
RewriteRule ^recommend.html modules.php?name=Recommend_Us

#Reviews
RewriteRule ^reviews-new.html modules.php?name=Reviews&rop=write_review
RewriteRule ^reviews-preview.html modules.php?name=Reviews&rop=preview_review
RewriteRule ^reviews-([0-9]*)-page([0-9]*).html modules.php?name=Reviews&rop=showcontent&id=$1&page=$2
RewriteRule ^reviews-([0-9]*).html modules.php?name=Reviews&rop=showcontent&id=$1
RewriteRule ^reviews-comment-([0-9]*)-([[:punct:]?/:\-\'{}()._&a-zA-Z0-9+=\%]*).* modules.php?name=Reviews&rop=postcomment&id=$1&title=$2
RewriteRule ^reviews-([0-9]*)-delete.html modules.php?name=Reviews&rop=del_review&id_del=$1
RewriteRule ^reviews-([0-9]*)-edit.html modules.php?name=Reviews&rop=mod_review&id=$1
RewriteRule ^reviews-([0-9]*)-delcomment-([0-9]*).html modules.php?name=Reviews&rop=del_comment&cid=$1&id=$2
RewriteRule ^reviews-([a-zA-Z0-9]*)-orderby-([a-z]*)-([a-zA-Z]*).html modules.php?name=Reviews&rop=$1&field=$2&order=$3
RewriteRule ^reviews-sortby-([a-zA-Z0-9]*).html modules.php?name=Reviews&rop=$1
RewriteRule ^reviews.html modules.php?name=Reviews

#Search
RewriteRule ^search.html modules.php?name=Search

#Statistics
RewriteRule ^stats-([0-9]*)-([0-9]*)-([0-9]*).html modules.php?name=Statistics&op=DailyStats&year=$1&month=$2&date=$3
RewriteRule ^stats-([0-9]*)-([0-9]*).html modules.php?name=Statistics&op=MonthlyStats&year=$1&month=$2
RewriteRule ^stats-([0-9]*).html modules.php?name=Statistics&op=YearlyStats&year=$1
RewriteRule ^advstats.html modules.php?name=Statistics&op=Stats
RewriteRule ^stats.html modules.php?name=Statistics

#Stories Archive
RewriteRule ^archive-([0-9]*)-([0-9]*)-([a-zA-Z]*).* modules.php?name=Stories_Archive&sa=show_month&year=$1&month=$2&month_l=$3
RewriteRule ^archive-showall.html modules.php?name=Stories_Archive&sa=show_all
RewriteRule ^archive.html modules.php?name=Stories_Archive
php_flag display_errors on
php_flag display_startup_errors on    
4
  • Can you give us a minimal example of a regex that doesn't work? Commented Jul 10, 2014 at 21:29
  • Well, all those ? in your regex will cause that. Did you paste into an editor that doesn't do unicode? Commented Jul 10, 2014 at 21:41
  • Thanks,first post edited and I add more lines.I didn't paste to editor, just copy from .htaccess file from Directadmin editor Commented Jul 11, 2014 at 11:20
  • And your question is? Which part of the error message is not clear to you? And why do you paste many lines of your .htaccess file while the error highlights an issue with a single expression? It should be fine to just paste that line (plus a little context if appropriate). Commented Oct 9, 2014 at 12:30

1 Answer 1

0

Your regex does not compile because the hyphen - is interpreted as a character range marker. Move it to the top of the character range. We can also make a few tweaks, although it's hard to know the exact intent. Try this:

^encyclopedia-terms([0-9]*)-([-\w\xa2\xa7\xa8\xa9\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xbe\x82\x83\x84\x85\x86\x88\x87\x8c]*).html
  • moved the -
  • used \w instead of letters, digits and underscores
  • removed the ? which serve no purpose
  • reorganized the chars

This can be shortened to:

^encyclopedia-terms([0-9]*)-([-\w\xa2§-©«-¹\xbe\x82-\x88\x8c]*).html
Sign up to request clarification or add additional context in comments.

7 Comments

Thanks, htaccess file is very big and contain many line of rules.I edit first poet and put some lines in it. Should I change all lines?
Thanks for care. Actually with changing 1 line problem not solved, should I change all Lines?
I only changed the one that had the compile error. Do you have new compile errors?
last compile error seems solved, but know another line have problem:/public_html/.htaccess: RewriteRule: cannot compile regular expression '^special-links-([0-9]*)-([a-zA-Z0-9_-?\xa7?\xa2?\xa8U\xbe???\xab?\xac?\x86?\xad?\xae?\xaf?\xb0?\xb1?\xb2???\xb3?\xb4?\xb5?\xb6?\xb7?\xb8?\xb9??U?U\x82U\x83?\xa9?\xafU\x84U\x85U\x86U\x88U\x87U\x8cU?]*).html
I change that line like your sample and one by one error is changing to next line.what bout this? ^special-links/([0-9]*)/([a-zA-Z0-9_-?\xa7?\xa2?\xa8U\xbe???\xab?\xac?\x86?\xad?\xae?\xaf?\xb0?\xb1?\xb2???\xb3?\xb4?\xb5?\xb6?\xb7?\xb8?\xb9??U?U\x82U\x83?\xa9?\xafU\x84U\x85U\x86U\x88U\x87U\x8cU?]*)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.