Permalinks and my need for http://www.sitename rather than just http://sitename

7 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 31, 2015   (RSS)

By Twocans - July 9, 2015

Hello,
I cannot understand what I did wrong as I have compared it with another site and idnt have this problem.

I see the permalink is shown as http://mysite.com rather then http:///www.mysite.com

See attached photo.

I do need to have the www as I will also be having a mobile site . (I am aware permalinks cannot do mobile at the moment and will do the htaccess code for mobile site by hand)

Can you advise as to how to get the www in my permalink please.

regards

Kenny

Attachments:

permalinks-www-q.png 23K

By Twocans - July 9, 2015

OK I got it.

Gosh I feel so stupid, 

OK originally , when I logged into the cms using

http://mysitename.com/cmsfolder/admin.php

by doing so the permalinks show as http://mysitename

but by logging out..... and re logging back in using 

http://www.mysitename.com/cmsfolder/admin.php

permalinks does as I want and allows me to load links as i required. aka www.

anyway good evening

Kenny

By gregThomas - July 9, 2015

Hey Twocans,

I took a look at the permalinks code base and the label on the permalink box is based on the current domain you're accessing the CMS from. 

When you change my address from non www to www, the label for the permalink on the page also updates to include www.

When the permalink system runs it works off the URL path, and doesn't take  the actual domain into account. The label on this field is just to guide CMS users. So you don't need to worry if the label doesn't have the correct domain appearing in it. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Twocans - July 9, 2015

Cheers Greg,

thank you

Kenny

By Twocans - July 30, 2015

thank you Greg.

kenny

By Dave - July 31, 2015

Hi Kenny,

If you're using the latest Permalinks (v1.03) you can click on the code generator and it will include some default code for forcing all connections to use www.

It looks something like this: 

# Add this to an .htaccess file in your website root folder
# Your website root folder is usually named: htdocs, httpdocs, www, html, or just / in FTP

# START: CMS Permalink Code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^permalinks_dispatcher\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sb/cmsb3/cmsb/plugins/permalinks/permalinks_dispatcher.php [L]


### Set URL_SCHEME (REQUEST_SCHEME isn't available before Apache < 2.4 and can include hostname)
RewriteCond %{HTTPS} off
RewriteRule .* - [E=URL_SCHEME:http]
RewriteCond %{HTTPS} on
RewriteRule .* - [E=URL_SCHEME:https]

### Force www. prefix - (RECOMMENDED/OPTIONAL) SEO to prevent duplicate urls (uncomment to use)
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^(.*)$ %{ENV:URL_SCHEME}://www.%{HTTP_HOST}/$1 [R=301,L]


### Remove www prefix - Optional SEO to prevent duplicate urls (uncomment to use)
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ %{ENV:URL_SCHEME}://%1/$1 [R=301,L]

### Force HTTPS secure connections - Optional security (uncomment to use)
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

</IfModule>
# END: CMS Permalink Code

If you add/enable that it will automatically ensure everyone is on the www. subdomain.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com