# Apache rules for the static export. `next build` copies this file to out/.
#
# Permanent redirects for URLs Google indexed from the previous WordPress site
# (its Rank Math sitemaps), each to the page that replaced it. Old URLs with no
# equivalent page are deliberately left to 404.

<IfModule mod_rewrite.c>
  RewriteEngine On

  # One host: www.murphi.ai serves the same pages, so send it to the apex.
  RewriteCond %{HTTP_HOST} ^www\.murphi\.ai$ [NC]
  RewriteRule ^ https://murphi.ai%{REQUEST_URI} [R=301,L]
</IfModule>

<IfModule mod_alias.c>
  # Retired WordPress / Rank Math sitemaps -> the current sitemap. Never
  # matches /sitemap.xml itself.
  RedirectMatch 301 ^/(sitemap_index|sitemap-index|wp-sitemap[a-z0-9_-]*|[a-z0-9_]+-sitemap[0-9]*)\.xml$ https://murphi.ai/sitemap.xml

  # Pages renamed in the rebuild.
  RedirectMatch 301 ^/ambient-ai/?$ https://murphi.ai/ambient-ai-dictation/
  RedirectMatch 301 ^/ai-patient-financials/?$ https://murphi.ai/patient-payments/
  RedirectMatch 301 ^/integration/?$ https://murphi.ai/integrations/
  RedirectMatch 301 ^/(ehr-emr-companies|ehr-ai-integration-platform|white-labeling|white-label-partner-program)/?$ https://murphi.ai/ehr-companies/
  RedirectMatch 301 ^/(coding-billing|rcm-companies|qapi-compliance)/?$ https://murphi.ai/coding-billing-rcm/
  RedirectMatch 301 ^/accreditation-audit/?$ https://murphi.ai/accreditation-bodies/
  RedirectMatch 301 ^/(post-acute-care|post-acute-car)/?$ https://murphi.ai/agencies/
  RedirectMatch 301 ^/support-ticket/?$ https://murphi.ai/contact-us/
  RedirectMatch 301 ^/download-old-app/?$ https://murphi.ai/download-app/

  # Announcements were root-level WordPress posts; same slug under /announcements/.
  RedirectMatch 301 ^/(docuguard-ai-and-murphi-ai-partner-to-advance-ai-for-home-health-and-hospice|murphi-ai-wins-bronze-stevie-award-at-the-2026-american-business-awards|revenue-assurance-compliance-reports-for-home-health-hospice|stuart-smith-joins-murphi-board-advisor|docuguard-connects-with-murphi|murphi-ai-business-insider-healthcare-ai-growth|murphi-ai-apple-news|murphi-ai-meditech-today|murphi-ai-tech-times|murphi-ais-playbook-for-making-healthcare-platforms-ai-native-without-the-rebuild|murphi-ais-horizontal-native-ai-platform-one-integration-multiple-healthcare-workflows|inside-murphi-ais-ai-blueprint-for-modernizing-rcm-patient-payments-and-contract-optimization|how-guru-tadiparti-steered-murphi-ai-by-embedding-ai-into-healthcare-platforms|murphi-ai-posts-strong-arr-growth-by-embedding-ai-automation-across-ehr-rcm-and-healthcare-platforms|why-mental-health-and-post-acute-platforms-are-turning-to-murphi-ais-ai-inside-white-label-model)/?$ https://murphi.ai/announcements/$1/
  # The two announcement categories -> the announcements listing.
  RedirectMatch 301 ^/category/(news-announcements|in-the-news)/?$ https://murphi.ai/announcements/

  # Care settings that moved to MurphiConnect.ai, each to its matching page.
  RedirectMatch 301 ^/(mental-behavioral-health|embed-ai-into-ehr-workflows-mental-and-behavioural-health)/?$ https://murphiconnect.ai/mental-behavioral-health/
  RedirectMatch 301 ^/(primary-specialty-care|primary-speciality-care|primary-and-speciality-care-embed-into-ehr)/?$ https://murphiconnect.ai/primary-specialty-care/
  RedirectMatch 301 ^/(public-health-and-corrections|public-health-corrections|public-health-and-corrections-embed-ai-into-ehr-workflows)/?$ https://murphiconnect.ai/public-correctional-health/
</IfModule>

<IfModule mod_headers.c>
  # PostWyse shows draft previews of this site inside its editor. Only the site
  # itself and PostWyse may frame its pages.
  Header always set Content-Security-Policy "frame-ancestors 'self' https://postwyse.com https://app.postwyse.com"
  Header always unset X-Frame-Options
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On
  # A post published from PostWyse after the last build has no folder yet, so
  # /blog/{slug}/ is served by the post page, which reads the slug from the address.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^blog/([a-z0-9-]+)/?$ /blog/post/index.html [L]
</IfModule>
