# invoke rewrite engine
RewriteEngine On
RewriteBase /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/

Options -Indexes
<IfModule mod_negotiation.c>
	Options -MultiViews
</IfModule>

# Redirect 400,401,403,404,500 to main website
ErrorDocument 400 https://wuf9.org
ErrorDocument 401 https://wuf9.org
ErrorDocument 403 https://wuf9.org
ErrorDocument 404 https://wuf9.org
ErrorDocument 500 https://wuf9.org

# Add a trailing slash (/) to a URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.[A-Za-z0-9]*$
RewriteRule .*[^/]$ %{REQUEST_URI}/ [L,R=301]

# Specific redirections
RewriteRule ^index\.html$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/ [L,R=301]

RewriteRule ^programme/side-events/environmental-and-social-impact-assessment-what-is-its-impact-and-effectiveness-for-the-poor-in-african-cities-the-environmental-assessment-process-can-contributes-to-sustainable-development-throug$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/e-development-throug_p3v3nm6867ryxpgkmny0m4/ [L,R=301,QSD]
RewriteRule ^programme/listen-to-cities-room-local-action/the-city-and-the-territory-the-role-of-intermediary-cities-and-the-territorial-approach-to-local-development-for-achieving-the-sdgs-and-the-new-urban-agenda$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/the-new-urban-agenda_opj6f8pna7ufp7dy722ip7/ [L,R=301,QSD]
RewriteRule ^programme/networking-events/urban-transformation-in-russian-cities-in-times-of-mega-events-and-economic-transition-learning-from-the-adoption-of-the-new-urban-agenda-and-the-implementation-of-the-sdg11$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/ntation-of-the-sdg11_4gbp7te6v0fpguc6jytsmr/ [L,R=301,QSD]
RewriteRule ^programme/listen-to-cities-room-local-action/towards-social-and-urban-integration-of-slums-and-precarious-settlements-implementing-the-law-for-fair-access-to-habitat-and-new-urban-agenda-in-the-province-of-buenos-aires$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/ince-of-buenos-aires_fu2esv8vh8ztts6sxqfqjp/ [L,R=301,QSD]
RewriteRule ^programme/one-un-room/physical-inactivity-and-rising-non-communicable-diseases-how-creating-space-for-sport-can-support-the-implementation-of-the-new-urban-agenda-and-drive-socioeconomic-development-in-asia-pacific$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/ment-in-asia-pacific_apd8h0p2rnpcjyjkuo2mdt/ [L,R=301,QSD]
RewriteRule ^programme/side-events/citizen-city-collaboration-in-contested-spaces-from-theory-to-practice-real-world-examples-for-implementing-the-new-urban-agenda-at-three-scales-the-neighborhood-of-kibera-the-city-of-dhaka-and-t$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/-city-of-dhaka-and-t_6f3kwbp0yk38tceoa6tg23/ [L,R=301,QSD]
RewriteRule ^programme/side-events/national-policies-for-strengthening-the-role-and-resilience-of-local-authorities-towards-implementing-global-development-frameworks-and-local-economic-growth-implementing-the-new-urban-agenda$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/the-new-urban-agenda_8ozc7mived0aktpj2ems20/ [L,R=301,QSD]
RewriteRule ^programme/listen-to-cities-room-local-action/turning-urban-shrinkage-into-opportunities-for-sustainable-redevelopment-reflection-from-the-experience-of-the-city-of-saint-etienne-france-and-invitation-to-an-international-dialogue$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/ternational-dialogue_0p5g65nq5nt8igfdkuah4y/ [L,R=301,QSD]
RewriteRule ^programme/networking-events/les-dispositifs-pratiques-et-outils-de-gouvernance-locale-participative-et-dinclusion-sociale-pour-promouvoir-les-droits-a-la-cites-et-operationnaliser-le-nouvel-agenda-urbain-et-les-objectifs-de-de$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/-les-objectifs-de-de_poo8za7s87bz2jpfbkompb/ [L,R=301,QSD]
RewriteRule ^programme/side-events/delivering-priority-infrastructure-improved-services-and-planned-cities-for-urban-management-an-inclusive-approach-to-implementing-the-new-urban-agenda-and-achieving-the-sdgs$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/d-achieving-the-sdgs_c50hyssmmgawezv8dtddby/ [L,R=301,QSD]
RewriteRule ^programme/networking-events/dealing-with-rapid-urbanisation-tools-and-experiences-the-rapid-rates-and-scale-of-urbanisation-around-the-world-are-a-core-focus-for-all-involved-in-creating-sustainable-cities-and-communities-whi$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/-and-communities-whi_4rd3u4emvn7emff6cbtaii/ [L,R=301,QSD]
RewriteRule ^programme/side-events/a-multidimensional-view-of-the-implementation-of-the-new-world-urban-agenda-from-the-micro-territory-and-community-sustainability-in-neighborhoods-of-informal-origin-case-studies-san-agustin-neighb$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/s-san-agustin-neighb_0fnaai6gind0osujhjs4s4/ [L,R=301,QSD]
RewriteRule ^programme/side-events/implementation-of-the-fukuoka-method-landfill-and-solid-waste-management-system-a-low-cost-and-environmentally-sustainable-solution-to-tackle-solid-waste-issues-in-the-growing-urban-sector$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/growing-urban-sector_soxmypf5uwrza2aoqygw5g/ [L,R=301,QSD]
RewriteRule ^programme/side-events/managing-natural-disaster-risks-in-cities-tomorrow-how-can-multilateral-and-bilateral-financing-institutions-contribute-to-urban-resilience-through-financing-knowledge-and-technical-expertise$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/-technical-expertise_vejv68qxoh7yx3gj5k378q/ [L,R=301,QSD]
RewriteRule ^programme/side-events/the-role-of-local-governments-in-the-implementation-of-the-new-urban-agenda-and-ensuring-sustainable-urban-development-lessons-learned-from-the-big-six-cities-of-the-punjab-pakistan$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/-the-punjab-pakistan_7pi3habsnkdhimnsvd0s6i/ [L,R=301,QSD]
RewriteRule ^programme/networking-events/measurement-index-and-dashboards-for-measurement-of-progress-and-success-towards-achieving-sustainable-development-goals-in-the-establishment-of-smart-sustainable-cities$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/files/t-sustainable-cities_x2mke35m3yuy4r43e7tum0/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^d=13$
RewriteRule ^un-habitat/?$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/un-habitat/d-13/ [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^d=13$
RewriteRule ^programme/thematic-itineraries/?$ /scraping/files/live/wuf9.org_nadiafahira138_gmail.com_2jaooq6lyh/programme/thematic-itineraries/d-13/ [L,R=301,QSD]

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

# Redirect all extensions to html
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.shtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.phtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jhtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.htm$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.php$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.aspx$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.asp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jsp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.apk$ $1.html [L,NC,R=301]
# End: Redirect all extensions to html
