| Linux sh105.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 Path : /home2/ctsnewco/public_html/abbestates/ |
| Current File : /home2/ctsnewco/public_html/abbestates/.htaccess |
############################################
# REWRITE ENGINE
############################################
RewriteEngine On
############################################
# FORCE HTTPS + NON-WWW
############################################
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://abbestates.com%{REQUEST_URI} [R=301,L,NE]
############################################
# REMOVE INDEX.PHP
############################################
RewriteCond %{THE_REQUEST} \s/+(.*/)?index\.php[\s?] [NC]
RewriteRule ^(.*/)?index\.php$ /$1 [R=301,L]
############################################
# SEO REDIRECTS
############################################
Redirect 301 /contact-us /contact
Redirect 301 /career /contact
Redirect 301 /duplex /flats-2bhk-3bhk
Redirect 301 /apartment /commercial-leasing
############################################
# CLEAN URLS (.PHP REMOVAL)
############################################
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/.]+)/?$ $1.php [L]
RewriteCond %{THE_REQUEST} \s/([^.]+)\.php[\s?] [NC]
RewriteCond %1 !^(404|500|401|403|xml-sitemap)$ [NC]
RewriteRule ^([^.]+)\.php$ /$1 [R=301,L]
############################################
# BLOG ROUTING
############################################
# Block invalid query-based access
RewriteCond %{QUERY_STRING} (^|&)u= [NC]
RewriteRule ^blogs/[^/]+$ - [F,L]
# Blog routing
RewriteRule ^blogs/([^/]+)$ blog-details.php?u=$1 [L,QSA]
# Clean blogs trailing slash
RewriteRule ^blogs/$ /blogs [R=301,L]
# Block direct access
RewriteRule ^blog-details$ - [F,L]
############################################
# WEBP + AVIF SUPPORT
############################################
RewriteCond %{HTTP_ACCEPT} image/avif
RewriteCond %{REQUEST_FILENAME}\.avif -f
RewriteRule ^(.+)\.(jpg|jpeg|png)$ $1.$2.avif [T=image/avif,E=accept:1,L]
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME}\.webp -f
RewriteRule ^(.+)\.(jpg|jpeg|png)$ $1.$2.webp [T=image/webp,E=accept:1,L]
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
############################################
# BROWSER CACHE
############################################
<IfModule mod_expires.c>
ExpiresActive On
# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/avif "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
# Fonts
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
# CSS JS
ExpiresByType text/css "access plus 30 days"
ExpiresByType application/javascript "access plus 30 days"
# HTML
ExpiresByType text/html "access plus 1 hour"
</IfModule>
############################################
# ERROR PAGES
############################################
ErrorDocument 400 /400.php