# Cue www URL policy for IONOS Apache (apex HTTPS, non-slash paths).
# Deployed with the static site; do not rely on WordPress for redirects.

RewriteEngine On
RewriteBase /

# Heal browsers that cached the bad filesystem-path Location from an earlier rule.
RewriteRule ^kunden/homepages/.+/htdocs/cuewww/(.*)$ /$1 [L,R=302]
RewriteRule ^kunden/homepages/.+/htdocs/cuewww/?$ / [L,R=302]

# HTTP → HTTPS and www → apex (single hop to https://cueplan.com)
RewriteCond %{HTTP_HOST} ^www\.cueplan\.com$ [NC,OR]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://cueplan.com%{REQUEST_URI} [L,R=301]

# The page head links to /feed; the file is feed.xml.
RewriteRule ^feed/?$ /feed.xml [L,R=301]

# Non-slash URLs with directory output (…/slug/index.html):
# DirectorySlash would 301 /blog → /blog/, fighting a slash-strip loop.
# Serve index.html via an absolute URL-path rewrite (leading /) — a relative
# "$1/" rewrite on IONOS leaked the filesystem path into Location.
DirectorySlash Off
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^ %1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ /$1/index.html [L]

<Files "feed.xml">
  ForceType application/rss+xml
</Files>
