# Add a trailing slash (/) to a URL
rewrite ^([^.]*[^/])$ $1/ permanent;

# Specific redirections
if ($args ~* ^option=com_content&view=article&id=14\%3Acommentary-and-information&catid=15\%3Apesticide-use&Itemid=108&;showall=1$){ rewrite ^//?$ /option-com_content-view-article-id-14-commentary-and-information-catid-15-pesticide-use-Itemid-108--showall-1/? permanent; }
if ($args ~* ^option=com_content&view=article&id=151\:colony-collapse-disorder-in-honeybeesn&catid=15\:pesticide-use&Itemid=108$){ rewrite ^//?$ /option-com_content-view-article-id-151-colony-collapse-disorder-in-honeybeesn-catid-15-pesticide-use-Itemid-108/? permanent; }
if ($args ~* ^option=com_content&task=category&sectionid=17&id=46&Itemid=61\%E2\%80\%99$){ rewrite ^//?$ /option-com_content-task-category-sectionid-17-id-46-Itemid-61-/? permanent; }
if ($args ~* ^option=com_content&task=category&sectionid=17&id=46&Itemid=61$){ rewrite ^//?$ /option-com_content-task-category-sectionid-17-id-46-Itemid-61/? permanent; }
if ($args ~* ^option=com_frontpage&Itemid=1$){ rewrite ^//?$ /option-com_frontpage-Itemid-1/? permanent; }
if ($args ~* ^option=com_content&view=article&id=14\:commentary-and-information&catid=15\:pesticid$){ rewrite ^//?$ /option-com_content-view-article-id-14-commentary-and-information-catid-15-pesticid/? permanent; }
if ($args ~* ^option=com_content&view=article&id=14\%3Acommentary-and-information&catid=15\%3Apesticide-$){ rewrite ^//?$ /option-com_content-view-article-id-14-commentary-and-information-catid-15-pesticide-/? permanent; }
if ($args ~* ^option=com_content&view=article&id=14\%3Acommentary-and-information&catid=15\%3Apesticide-use&Itemid=108&showall=1$){ rewrite ^//?$ /option-com_content-view-article-id-14-commentary-and-information-catid-15-pesticide-use-Itemid-108-showall-1/? permanent; }
if ($args ~* ^option=com_content&view=article&id=14\%3Acommentary-and-information&catid=15\%3Apesticide-use&Itemid=108$){ rewrite ^//?$ /option-com_content-view-article-id-14-commentary-and-information-catid-15-pesticide-use-Itemid-108/? permanent; }
if ($args ~* ^option=com_content&view=article&id=152\:cotton-vs-hempn&catid=15\:pesticide-use&Itemid=108$){ rewrite ^//?$ /option-com_content-view-article-id-152-cotton-vs-hempn-catid-15-pesticide-use-Itemid-108/? permanent; }
if ($args ~* ^option=com_content&view=article&id=70\:april-2007&catid=45\:the-bugman-reports-2007&Itemid=60$){ rewrite ^//?$ /option-com_content-view-article-id-70-april-2007-catid-45-the-bugman-reports-2007-Itemid-60/? permanent; }
if ($args ~* ^option=com_content&view=article&id=29\:white-flour-or-mites&catid=7\:faqs&Itemid=35$){ rewrite ^//?$ /option-com_content-view-article-id-29-white-flour-or-mites-catid-7-faqs-Itemid-35/? permanent; }
if ($args ~* ^option=com_content&view=article&id=30\:black-widows-everywhere&catid=7\:faqs&Itemid=35$){ rewrite ^//?$ /option-com_content-view-article-id-30-black-widows-everywhere-catid-7-faqs-Itemid-35/? permanent; }
if ($args ~* ^option=com_contact&task=view&contact_id=1&Itemid=36$){ rewrite ^//?$ /option-com_contact-task-view-contact_id-1-Itemid-36/? permanent; }
if ($args ~* ^id=12&itemid=31&option=com_content&task=view$){ rewrite ^//?$ /id-12-itemid-31-option-com_content-task-view/? permanent; }
if ($args ~* ^option=com_content&task=view&id=12&Itemid=31$){ rewrite ^//?$ /option-com_content-task-view-id-12-Itemid-31/? permanent; }
if ($args ~* ^option=com_content&task=view&id=14&Itemid=45&limit=1&limitstart=1$){ rewrite ^//?$ /option-com_content-task-view-id-14-Itemid-45-limit-1-limitstart-1/? permanent; }
if ($args ~* ^Itemid=45&id=14&option=com_content&task=view$){ rewrite ^//?$ /Itemid-45-id-14-option-com_content-task-view/? permanent; }
if ($args ~* ^option=com_content&task=view&id=14&Itemid=45$){ rewrite ^//?$ /option-com_content-task-view-id-14-Itemid-45/? permanent; }
if ($args ~* ^option=com_content&view=article&id=14\:$){ rewrite ^//?$ /option-com_content-view-article-id-14-/? permanent; }
if ($args ~* ^option=com_content&task=view&id=15&Itemid=35$){ rewrite ^//?$ /option-com_content-task-view-id-15-Itemid-35/? permanent; }
if ($args ~* ^option=com_content&task=view&id=15$){ rewrite ^//?$ /option-com_content-task-view-id-15/? permanent; }
if ($args ~* ^option=com_content&task=view&id=21&Itemid=35$){ rewrite ^//?$ /option-com_content-task-view-id-21-Itemid-35/? permanent; }
if ($args ~* ^option=com_content&task=view&id=30&It$){ rewrite ^//?$ /option-com_content-task-view-id-30-It/? permanent; }
if ($args ~* ^option=com_content&task=view&id=30&Itemid=35$){ rewrite ^//?$ /option-com_content-task-view-id-30-Itemid-35/? permanent; }
if ($args ~* ^option=com_content&task=view&id=34&Itemid=35$){ rewrite ^//?$ /option-com_content-task-view-id-34-Itemid-35/? permanent; }
if ($args ~* ^option=com_content&view=article&id=43&Itemid=98$){ rewrite ^//?$ /option-com_content-view-article-id-43-Itemid-98/? permanent; }
if ($args ~* ^openidserver=1$){ rewrite ^//?$ /openidserver-1/? permanent; }
if ($args ~* ^s=Fleas&submit=Search$){ rewrite ^//?$ /s-Fleas-submit-Search/? permanent; }
if ($args ~* ^submit=Search$){ rewrite ^//?$ /submit-Search/? permanent; }
rewrite ^/donate\stoday\.html$ /donatetoday/? permanent;
if($is_args = ''){ rewrite ^/index\.php$ /index_php/? permanent; }
if ($args ~* ^option=com_contact&catid=12&Itemid=36$){ rewrite ^/index\.php$ /index_option-com_contact-catid-12-Itemid-36/? permanent; }
if ($args ~* ^option=com_contact&task=view&contact_id=1&Itemid=36$){ rewrite ^/index\.php$ /index_option-com_contact-task-view-contact_id-1-Itemid-36/? permanent; }
if ($args ~* ^option=com_content&task=view&id=12&Itemid=31$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-12-Itemid-31/? permanent; }
if ($args ~* ^option=com_content&task=blogsection&id=12&Itemid=39$){ rewrite ^/index\.php$ /index_option-com_content-task-blogsection-id-12-Itemid-39/? permanent; }
if ($args ~* ^option=com_content&task=blogcategory&id=15&Itemid=45$){ rewrite ^/index\.php$ /index_option-com_content-task-blogcategory-id-15-Itemid-45/? permanent; }
if ($args ~* ^option=com_content&task=blogcategory&id=23&Itemid=44$){ rewrite ^/index\.php$ /index_option-com_content-task-blogcategory-id-23-Itemid-44/? permanent; }
if ($args ~* ^option=com_content&task=section&id=4&Itemid=26$){ rewrite ^/index\.php$ /index_option-com_content-task-section-id-4-Itemid-26/? permanent; }
if ($args ~* ^option=com_content&task=category&sectionid=15&id=41&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-category-sectionid-15-id-41-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=blogsection&id=6&Itemid=28$){ rewrite ^/index\.php$ /index_option-com_content-task-blogsection-id-6-Itemid-28/? permanent; }
if ($args ~* ^option=com_content&task=category&sectionid=3&id=7&Itemid=35$){ rewrite ^/index\.php$ /index_option-com_content-task-category-sectionid-3-id-7-Itemid-35/? permanent; }
if ($args ~* ^option=com_content&task=blogsection&id=7&Itemid=42$){ rewrite ^/index\.php$ /index_option-com_content-task-blogsection-id-7-Itemid-42/? permanent; }
if ($args ~* ^option=com_frontpage&Itemid=1$){ rewrite ^/index\.php$ /index_option-com_frontpage-Itemid-1/? permanent; }
if ($args ~* ^option=com_weblinks&Itemid=38$){ rewrite ^/index\.php$ /index_option-com_weblinks-Itemid-38/? permanent; }
if ($args ~* ^option=com_search&Itemid=5$){ rewrite ^/index\.php$ /index_option-com_search-Itemid-5/? permanent; }
if ($args ~* ^option=com_wrapper&Itemid=52$){ rewrite ^/index\.php$ /index_option-com_wrapper-Itemid-52/? permanent; }
if ($args ~* ^option=com_registration&task=lostPassword$){ rewrite ^/index\.php$ /index_option-com_registration-task-lostPassword/? permanent; }
if ($args ~* ^option=com_contact&task=view&contact_id=2&Itemid=36$){ rewrite ^/index\.php$ /index_option-com_contact-task-view-contact_id-2-Itemid-36/? permanent; }
if ($args ~* ^option=com_content&task=view&id=14&Itemid=45$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-14-Itemid-45/? permanent; }
if ($args ~* ^option=com_content&task=category&sectionid=4&id=28&Itemid=26$){ rewrite ^/index\.php$ /index_option-com_content-task-category-sectionid-4-id-28-Itemid-26/? permanent; }
if ($args ~* ^option=com_content&task=view&id=44&Itemid=49$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-44-Itemid-49/? permanent; }
if ($args ~* ^option=com_content&task=view&id=46&Itemid=50$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-46-Itemid-50/? permanent; }
if ($args ~* ^option=com_content&task=category&sectionid=17&id=46&Itemid=61$){ rewrite ^/index\.php$ /index_option-com_content-task-category-sectionid-17-id-46-Itemid-61/? permanent; }
if ($args ~* ^option=com_content&task=view&id=48&Itemid=37$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-48-Itemid-37/? permanent; }
if ($args ~* ^option=com_content&task=view&id=54&Itemid=46$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-54-Itemid-46/? permanent; }
if ($args ~* ^option=com_content&task=view&id=60&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-60-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=61&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-61-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=62&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-62-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=63&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-63-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=64&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-64-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=65&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-65-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=66&Itemid=59$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-66-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=89&Itemid=65$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-89-Itemid-65/? permanent; }
if ($args ~* ^option=com_content&amp$){ rewrite ^/index2\.php$ /index2_option-com_content-amp/? permanent; }
if ($args ~* ^option=com_content&task=view&id=14&pop=1&page=0&Itemid=45$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-14-pop-1-page-0-Itemid-45/? permanent; }
if ($args ~* ^option=com_content&task=view&id=41&pop=1&page=0&Itemid=28$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-41-pop-1-page-0-Itemid-28/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=41$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-41/? permanent; }
if ($args ~* ^option=com_content&task=view&id=60&pop=1&page=0&Itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-60-pop-1-page-0-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=60&itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-60-itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=61&pop=1&page=0&Itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-61-pop-1-page-0-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=61&itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-61-itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=62&pop=1&page=0&Itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-62-pop-1-page-0-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=62&itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-62-itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=63&pop=1&page=0&Itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-63-pop-1-page-0-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=63&itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-63-itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=64&pop=1&page=0&Itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-64-pop-1-page-0-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=64&itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-64-itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=65&pop=1&page=0&Itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-65-pop-1-page-0-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=65&itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-65-itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=view&id=66&pop=1&page=0&Itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-view-id-66-pop-1-page-0-Itemid-59/? permanent; }
if ($args ~* ^option=com_content&task=emailform&id=66&itemid=59$){ rewrite ^/index2\.php$ /index2_option-com_content-task-emailform-id-66-itemid-59/? permanent; }
rewrite ^/Subscribe\sToday\.html$ /SubscribeToday/? permanent;
if ($args ~* ^option=com_content&task=view&id=30&Itemid=35$){ rewrite ^/index\.php$ /index_option-com_content-task-view-id-30-Itemid-35/? permanent; }

# Create pretty URLs
rewrite ^/([^/]+)/$ /$1.html last;
rewrite ^/([^/]+)/([^/]+)/$ /$1/$2.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7/$8.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7/$8/$9.html last;
rewrite ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3/$4/$5/$6/$7/$8/$9/$10.html last;
# End: Create pretty URLs

# Redirect all extensions to html
if ($is_args = ''){
	rewrite ^([^.]*)\.shtml$ $1.html permanent;
	rewrite ^([^.]*)\.phtml$ $1.html permanent;
	rewrite ^([^.]*)\.jhtml$ $1.html permanent;
	rewrite ^([^.]*)\.htm$ $1.html permanent;
	rewrite ^([^.]*)\.php$ $1.html permanent;
	rewrite ^([^.]*)\.aspx$ $1.html permanent;
	rewrite ^([^.]*)\.asp$ $1.html permanent;
	rewrite ^([^.]*)\.jsp$ $1.html permanent;
	rewrite ^([^.]*)\.apk$ $1.html permanent;
}
# End: Redirect all extensions to html
