# Enable URL rewriting
# ==============================
# 0. FORCE REMOVAL of "noindex"
# ==============================
Header unset X-Robots-Tag
RewriteEngine On
# ==============================
# 1. Force HTTPS and www
# ==============================
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.swarnavahini\.lk$ [NC]
RewriteRule ^(.*)$ https://www.swarnavahini.lk/$1 [L,R=301]
# ==============================
# 2. Serve robots.txt dynamically
# ==============================
RewriteRule ^robots\.txt$ robots.php [L]
# ==============================
# 3. Serve sitemap.xml dynamically
# ==============================
RewriteRule ^sitemap\.xml$ sitemap.php [L]
# ==============================
# 4. Allow Googlebot & Bingbot (fixes HTTP 403)
# ==============================
SetEnvIfNoCase User-Agent "Googlebot" allow_bot
SetEnvIfNoCase User-Agent "Bingbot" allow_bot
Require env allow_bot
Require all granted
# ==============================
# 5. Security: prevent access to hidden files (.htaccess, .git, etc.)
# ==============================
Require all denied
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit