Options -Indexes
DirectoryIndex news.php index.php index.html

<IfModule mod_rewrite.c>
    RewriteEngine On

    # MYCDIC ASPX veneer inside this nested newsroom context.
    RewriteCond %{THE_REQUEST} \s/+news/default/(.+?)\.html(?:[?\s]) [NC]
    RewriteRule ^(.+)\.html$ /news/default/$1.aspx [R=301,L,NE]
    RewriteCond %{DOCUMENT_ROOT}/news/default/$1.html -f
    RewriteRule ^(.+)\.aspx$ $1.html [L,NC]

    # Permanent, readable article URLs for search engines and news aggregators.
    RewriteRule ^article/([a-z0-9-]+)/?$ article.php?slug=$1 [L,QSA,NC]

    # Always serve live newsroom feeds from the protected CMS state. Static generated
    # XML copies may remain in the archive, but must never outrank the live records.
    # This prevents stale article URLs after a deployment or CMS data change.
    RewriteRule ^rss\.xml$ rss.xml.php [L]
    RewriteRule ^news-sitemap\.xml$ news-sitemap.xml.php [L]
    RewriteRule ^sitemap\.xml$ sitemap.xml.php [L]
</IfModule>

<IfModule mod_mime.c>
    AddType application/rss+xml .rss
    AddType application/xml .xml
</IfModule>

<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
    Header always set Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=()"
    <FilesMatch "\.(?:xml)$">
        Header set Cache-Control "public, max-age=900, stale-while-revalidate=3600"
    </FilesMatch>
    <FilesMatch "\.(?:jpg|jpeg|png|webp|css|js)$">
        Header set Cache-Control "public, max-age=604800, immutable"
    </FilesMatch>
</IfModule>
