# invoke rewrite engine
RewriteEngine On
RewriteBase /

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

# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Specific redirections
RewriteRule ^index\.html$ / [L,R=301]
RewriteRule ^birth-stories/tag/Birth\+Photographer$ birth-stories/tag/Birth-Photographer [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Birth\+Photography$ birth-stories/tag/Birth-Photography [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Indiana\+Birth\+Photographer$ birth-stories/tag/Indiana-Birth-Photographer [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Raw\+Motherhood$ birth-stories/tag/Raw-Motherhood [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^offset=1555436944089$
RewriteRule ^birth-stories$ birth-stories_offset-1555436944089 [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Renee\+Mason$ birth-stories/tag/Renee-Mason [L,R=301,QSD]
RewriteRule ^birth-stories/tag/IU\+Health\+Methodist$ birth-stories/tag/IU-Health-Methodist [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Home\+Birth$ birth-stories/tag/Home-Birth [L,R=301,QSD]
RewriteRule ^motherhood-blog/tag/Raw\+Motherhood$ motherhood-blog/tag/Raw-Motherhood [L,R=301,QSD]
RewriteRule ^motherhood-blog/tag/Birth\+Affirmations$ motherhood-blog/tag/Birth-Affirmations [L,R=301,QSD]
RewriteRule ^newborn-blog/tag/Fresh\+48$ newborn-blog/tag/Fresh-48 [L,R=301,QSD]
RewriteRule ^newborn-blog/tag/First\+48$ newborn-blog/tag/First-48 [L,R=301,QSD]
RewriteRule ^newborn-blog/tag/IU\+North$ newborn-blog/tag/IU-North [L,R=301,QSD]
RewriteRule ^newborn-blog/tag/Community\+North$ newborn-blog/tag/Community-North [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Water\+Birth$ birth-stories/tag/Water-Birth [L,R=301,QSD]
RewriteRule ^motherhood-blog/tag/Indiana\+Birth\+Photographer$ motherhood-blog/tag/Indiana-Birth-Photographer [L,R=301,QSD]
RewriteRule ^birth-stories/category/Fressh\+48$ birth-stories/category/Fressh-48 [L,R=301,QSD]
RewriteRule ^birth-stories/category/Maternity\+Milk\+Bath$ birth-stories/category/Maternity-Milk-Bath [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Fresh\+48$ birth-stories/tag/Fresh-48 [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Hendricks\+Regional\+Health$ birth-stories/tag/Hendricks-Regional-Health [L,R=301,QSD]
RewriteRule ^birth-stories/tag/IU\+Health\+Bloomington\+Hospital$ birth-stories/tag/IU-Health-Bloomington-Hospital [L,R=301,QSD]
RewriteRule ^birth-stories/tag/IU\+Health\+West$ birth-stories/tag/IU-Health-West [L,R=301,QSD]
RewriteRule ^birth-stories/tag/red\+raspberry\+leaf\+tea$ birth-stories/tag/red-raspberry-leaf-tea [L,R=301,QSD]
RewriteRule ^birth-stories/tag/Teen\+Mom$ birth-stories/tag/Teen-Mom [L,R=301,QSD]
RewriteCond %{QUERY_STRING} ^offset=1557106953999$
RewriteRule ^birth-stories$ birth-stories_offset-1557106953999 [L,R=301,QSD]
RewriteRule ^newborn-blog/category/First\+48$ newborn-blog/category/First-48 [L,R=301,QSD]

# Create pretty URLs
DirectorySlash Off

RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ %1 [NC,L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} (.*)/$
RewriteRule ^(.*)/$ $1 [NC,L,R=301]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]
# 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
