RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
thats for www/non www redirection
and this is for my maintenance page
ErrorDocument 503 /system/maintenance.html
RewriteEngine On
RewriteCond %{REQUEST_URI} !.(css|gif|jpg|png)$
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ - [redirect=503,last]
Thanks!
It depends on which one you want to be applied first and if the
RewriteBasecan be applied to both set of rules (I’m assuming it can because the 2nd rule doesn’t really care what the base is). You can also remove the duplicateRewriteEngine Ondirectives:This order means even if maintanence, the www to non-www still happens. If they were the other way around, you’d get maintanence handled regardless of whether the hostname was www or non-www.