# anslemoshionebo.com: static site (replaces WordPress)
Options -Indexes
DirectoryIndex index.html index.php
ErrorDocument 404 /404.html

<IfModule mod_rewrite.c>
RewriteEngine On

# anslemesi.com (and www) -> anslemoshionebo.com, when both domains share this folder
RewriteCond %{HTTP_HOST} ^(www\.)?anslemesi\.com$ [NC]
RewriteRule ^(.*)$ https://anslemoshionebo.com/$1 [R=301,L]

# Force HTTPS and non-www
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://anslemoshionebo.com/$1 [R=301,L]

# Old WordPress URLs
RewriteRule ^about-us/?$ /about/ [R=301,L]
RewriteRule ^press/?$ /news/ [R=301,L]
RewriteRule ^contact-us/?$ /contact/ [R=301,L]
RewriteRule ^blog/page/[0-9]+/?$ /blog/ [R=301,L]
RewriteRule ^(tag|category)/.*$ /blog/ [R=301,L]
RewriteRule ^author/.*$ /about/ [R=301,L]
RewriteRule ^(feed|comments/feed)/?$ /feed.xml [R=301,L]
RewriteRule ^[^/]+/feed/?$ /feed.xml [R=301,L]
RewriteRule ^(wp-sitemap|sitemap_index|post-sitemap|page-sitemap|sitemap)(-.*)?\.xml$ /sitemap.xml [R=301,L]
RewriteCond %{QUERY_STRING} (^|&)(p|page_id|tag|cat)= [NC]
RewriteRule ^$ /blog/? [R=301,L]

# Old WordPress image URLs that may be indexed in Google Images
RewriteRule ^wp-content/uploads/.*ANSLEM-OSHIONEBO-head1.*$ /assets/img/anslem-oshionebo-portrait.jpg [R=301,L,NC]
RewriteRule ^wp-content/uploads/.*ANSLEM-OSHIONEBO-head2.*$ /assets/img/anslem-oshionebo-seated.jpg [R=301,L,NC]
RewriteRule ^wp-content/uploads/.*How-Fintech-Generates-Profit.*$ /assets/img/how-fintech-generates-profit.jpg [R=301,L,NC]
RewriteRule ^wp-content/uploads/.*Africas-Role-in-Fintech.*$ /assets/img/africas-role-in-fintech.jpg [R=301,L,NC]

# Private folders
RewriteRule ^(_scheduled|tools/data)(/.*)?$ - [F,L]

# WordPress system paths are gone
RewriteRule ^(wp-admin|wp-includes|wp-content|wp-json)(/.*)?$ - [G,L]
RewriteRule ^(wp-login|xmlrpc|wp-cron)\.php$ - [G,L]

# Add trailing slash to folder URLs
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ /$1/ [R=301,L]
</IfModule>

<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set Strict-Transport-Security "max-age=31536000"
<FilesMatch "\.(css|js|woff2)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
<FilesMatch "\.(jpg|jpeg|png|webp|svg)$">
Header set Cache-Control "public, max-age=2592000"
</FilesMatch>
<FilesMatch "^site-config\.js$">
Header set Cache-Control "public, max-age=300"
</FilesMatch>
<FilesMatch "\.(html|xml|txt)$">
Header set Cache-Control "public, max-age=3600"
</FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/xml application/rss+xml application/javascript text/javascript application/json image/svg+xml
</IfModule>

AddType image/webp .webp
AddType font/woff2 .woff2
AddType text/plain .txt
