# www.pretoriatreefellingguru.co.za
RewriteEngine On

# Force HTTPS and www
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.pretoriatreefellingguru.co.za/$1 [L,R=301]

# /index.html -> /
RewriteCond %{THE_REQUEST} \s/index\.html[\s?] [NC]
RewriteRule ^index\.html$ / [L,R=301]

# Old WordPress pages -> new pages (permanent redirects keep the Google rankings)
RewriteRule ^pretoria-treefelling-services/?$ /tree-felling/pretoria.html [R=301,L,NC]
RewriteRule ^centurion-treefelling-services-2/?$ /tree-felling/centurion.html [R=301,L,NC]
RewriteRule ^treefellingpretoria/?$ /tree-felling/pretoria.html [R=301,L,NC]
RewriteRule ^palm-tree-cleaning-and-removal/?$ /palm-tree-services.html [R=301,L,NC]
RewriteRule ^pretoria-palm-tree-pruning/?$ /tree-pruning.html [R=301,L,NC]
RewriteRule ^difference-between-lopping-and-pruning/?$ /lopping-vs-pruning.html [R=301,L,NC]
RewriteRule ^hanging-over-tree/?$ /overhanging-branches.html [R=301,L,NC]
RewriteRule ^boundary-line-tree-cutting/?$ /overhanging-branches.html [R=301,L,NC]
RewriteRule ^site-clearing-and-plot-clearing/?$ /site-clearing.html [R=301,L,NC]
RewriteRule ^tree-stump-removal-and-grinding/?$ /stump-removal.html [R=301,L,NC]
RewriteRule ^stump-removal-and-grinding/?$ /stump-removal.html [R=301,L,NC]
RewriteRule ^storm-damaged-tree-removal/?$ /storm-damage-tree-removal.html [R=301,L,NC]
RewriteRule ^instant-lawn-pretoria/?$ /instant-lawn.html [R=301,L,NC]
RewriteRule ^pretoria-east-emergency-treefelling-services/?$ /emergency-tree-felling/pretoria-east.html [R=301,L,NC]
RewriteRule ^pretoria-emergency-treefelling-services/?$ /emergency-tree-felling/pretoria.html [R=301,L,NC]
RewriteRule ^centurion-emergency-treefelling-services-2/?$ /emergency-tree-felling/centurion.html [R=301,L,NC]
RewriteRule ^centurion-emergency-treefelling-services/?$ /emergency-tree-felling/centurion.html [R=301,L,NC]
RewriteRule ^rubble-removal-centurion/?$ /rubble-removal/centurion.html [R=301,L,NC]
RewriteRule ^rubble-removal-in-pretoria/?$ /rubble-removal/pretoria.html [R=301,L,NC]
RewriteRule ^rubble-removal-pretoria-east/?$ /rubble-removal/pretoria-east.html [R=301,L,NC]
RewriteRule ^rubble-removal-pretoria-north/?$ /rubble-removal/pretoria-north.html [R=301,L,NC]
RewriteRule ^tree-felling-pretoria-east/?$ /tree-felling/pretoria-east.html [R=301,L,NC]
RewriteRule ^treefelling-in-garsfontein/?$ /tree-felling/garsfontein.html [R=301,L,NC]
RewriteRule ^treefelling-garsfontein/?$ /tree-felling/garsfontein.html [R=301,L,NC]
RewriteRule ^treefelling-montana-park/?$ /tree-felling/montana-park.html [R=301,L,NC]
RewriteRule ^treefelling-faerie-glen/?$ /tree-felling/faerie-glen.html [R=301,L,NC]
RewriteRule ^treefelling-lynnwood/?$ /tree-felling/lynnwood.html [R=301,L,NC]
RewriteRule ^treefelling-moreleta/?$ /tree-felling/moreleta-park.html [R=301,L,NC]
RewriteRule ^treefelling-waterkloof/?$ /tree-felling/waterkloof.html [R=301,L,NC]
RewriteRule ^tree-felling-menlo-park/?$ /tree-felling/menlo-park.html [R=301,L,NC]
RewriteRule ^treefelling-silverlakes/?$ /tree-felling/silver-lakes.html [R=301,L,NC]
RewriteRule ^treefelling-brooklyn/?$ /tree-felling/brooklyn.html [R=301,L,NC]
RewriteRule ^treefelling-centurion/?$ /tree-felling/centurion.html [R=301,L,NC]
RewriteRule ^treefelling-lyttleton/?$ /tree-felling/lyttelton.html [R=301,L,NC]
RewriteRule ^treefelling-littleton/?$ /tree-felling/lyttelton.html [R=301,L,NC]
RewriteRule ^treefelling-eldoraigne/?$ /tree-felling/eldoraigne.html [R=301,L,NC]
RewriteRule ^eldoraigne-treefelling/?$ /tree-felling/eldoraigne.html [R=301,L,NC]
RewriteRule ^contact-us/?$ /contact.html [R=301,L,NC]
RewriteRule ^about-us/?$ /about.html [R=301,L,NC]
RewriteRule ^the-pretoria-treefelling-guru-about/?$ /about.html [R=301,L,NC]
RewriteRule ^frequently-asked-questions/?$ /faq.html [R=301,L,NC]
RewriteRule ^gallery/?$ / [R=301,L,NC]
RewriteRule ^covid-19-treefelling-precautions/?$ / [R=301,L,NC]

# Service folders without a page name -> the service page
RewriteRule ^tree-felling/?$ /tree-felling.html [R=301,L]
RewriteRule ^emergency-tree-felling/?$ /emergency-tree-felling.html [R=301,L]
RewriteRule ^storm-damage-tree-removal/?$ /storm-damage-tree-removal.html [R=301,L]
RewriteRule ^tree-pruning/?$ /tree-pruning.html [R=301,L]
RewriteRule ^palm-tree-services/?$ /palm-tree-services.html [R=301,L]
RewriteRule ^stump-removal/?$ /stump-removal.html [R=301,L]
RewriteRule ^site-clearing/?$ /site-clearing.html [R=301,L]
RewriteRule ^rubble-removal/?$ /rubble-removal.html [R=301,L]
RewriteRule ^instant-lawn/?$ /instant-lawn.html [R=301,L]
RewriteRule ^areas/?$ /areas.html [R=301,L]

# Old WordPress system paths
RewriteRule ^(wp-admin|wp-login\.php|feed|comments/feed)(/.*)?$ / [R=301,L,NC]

ErrorDocument 404 /404.html

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType image/svg+xml "access plus 1 month"
  ExpiresByType text/html "access plus 1 hour"
</IfModule>
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript image/svg+xml application/xml text/plain
</IfModule>

# Allow photo uploads on the quotation form (if your host permits .htaccess PHP settings)
<IfModule mod_php.c>
  php_value upload_max_filesize 6M
  php_value post_max_size 32M
  php_value max_file_uploads 6
</IfModule>
