[SOLVED] How to have links not use www

Post Reply
iamageneralist
Posts: 1
Joined: Wed Sep 13, 2017 5:12 am

[SOLVED] How to have links not use www

Post by iamageneralist »

I was hoping to use WonderCMS for a site where I need the CMS generated links (such as page links in the menu) to direct to http://websitename.com and NOT http://www.websitename.com.

With this particular domain the www directs to a separate server through a CNAME DNS management.

Is there an easy way to change how WonderCMS creates links from "http://www" to just "http://"?
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: How to have links not use www

Post by wiz »

There must be some other configuration on your server that does this redirect to www, as WonderCMS doesn't redirect to www by default (except in our demo).

Are you familiar with htaccess (if you're running on Apache)? Please check there aren't any other rewrites in other htaccess files that create the redirect to www.

You can edit the htaccess file that came along with WonderCMS. The end result of edited htaccess file that would result in redirecting from http://www.example.com to http://example.com.

Code: Select all

Options -Indexes
ServerSignature Off
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]
RewriteRule database.js - [F]
Since I don't know if there's any other configuration fighting with this one, let me know how it works. If you are not running on Apache, there will be other steps required.

Just in case question: what server type and what version of PHP are you running?

Optional steps:
- if the above those work, try removing the RewriteBase / line
Post Reply