leroy30
New Member
Hey guys.
Not very often I'm stuck enough to ask a question lol! But I am not very familiar with PHP or Apache (I normally do .Net websites) and I'm at a loss as to why I can't get my non-www to www redirect working!
The website is using a CMS called ModX evolution. I don't think this matters but just in case.
I am attempting the redirect in the ht.access file. The contents of which are below (with the real URL swapped out).
Any ideas what's wrong here? I'm not even seeing an error which makes things difficult!
Not very often I'm stuck enough to ask a question lol! But I am not very familiar with PHP or Apache (I normally do .Net websites) and I'm at a loss as to why I can't get my non-www to www redirect working!
The website is using a CMS called ModX evolution. I don't think this matters but just in case.
I am attempting the redirect in the ht.access file. The contents of which are below (with the real URL swapped out).
HTML:
# For full documentation and other suggested options, please see
# http://svn.modxcms.com/docs/display/MODx096/Friendly+URL+Solutions
# including for unexpected logouts in multi-server/cloud environments
# and especially for the first three commented out rules
#php_flag register_globals Off
#AddDefaultCharset utf-8
#php_value date.timezone Europe/Moscow
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
# Fix Apache internal dummy connections from breaking [(site_url)] cache
RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
RewriteRule .* - [F,L]
# Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} !^the-website\.co.nz [NC]
#RewriteRule (.*) http://www.the-website.co.nz/$1 [R=301,L]
#
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule (.*) index.php?q=$1 [QSA,L]
# Exclude /assets and /manager directories and images from rewrite rules
RewriteRule ^(manager|assets)/*$ - [L]
RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L]
# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# Reduce server overhead by enabling output compression if supported.
#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5
Any ideas what's wrong here? I'm not even seeing an error which makes things difficult!