"www" get (automaticly) added to url
Permalink
I created a block using "Block Builder". In that block I added an option to add a file (mp3), and load in in some custom html (and js:https://github.com/Freeedle/Essential-Audio-Player).... Everything works when I add the block. I add the mp3 publish the page and all works great.
After some time(?) the audio stops working. After some searching and contact with my host it seems that "www" is added to the url (with subdomain). So (not working):
in stead of (working):
After clearing cache or republishing, (or today just after login(?)) it starts loading correctly without the "www". But then after some time www is added again. In the attachments the block and htaccess file.
Any idea how this could happen and how to force the url to get loaded without the "www"?
After some time(?) the audio stops working. After some searching and contact with my host it seems that "www" is added to the url (with subdomain). So (not working):
data-url="https://www.xxx.xxx.nl/application/files/0000/0000/0000/nameoffile.mp3"
in stead of (working):
data-url="https://xxx.xxx.nl/application/files/0000/0000/0000/nameoffile.mp3"
After clearing cache or republishing, (or today just after login(?)) it starts loading correctly without the "www". But then after some time www is added again. In the attachments the block and htaccess file.
Any idea how this could happen and how to force the url to get loaded without the "www"?
Did you maybe set your canonical URLs with www included in your dashboard?
I thought the same. I checked, but there was no canonical url set. So I set it myself without the www. But unfortunately it still sometimes adds the www. Weird behavior, and I can't figure out why this is happening. So mayby there is a other way to force the block to get the url and strip the www?
Since this is a custom block you can simply use a str_replace on the URL to remove www.
Having said so, there is something definitely weird going on. Your HTACCESS is set to redirect all www URLs to non-www URLs. That means that if your URL got a www it should still work, the HTACCESS directive should simply redirect it.
So I have 2 questions:
First the obvious: are you sure your no-www redirect is working?
Second: maybe you have a vhost setting on your server that is pushing the www URL when concrete5 is pinging the server to get the host?
Having said so, there is something definitely weird going on. Your HTACCESS is set to redirect all www URLs to non-www URLs. That means that if your URL got a www it should still work, the HTACCESS directive should simply redirect it.
So I have 2 questions:
First the obvious: are you sure your no-www redirect is working?
Second: maybe you have a vhost setting on your server that is pushing the www URL when concrete5 is pinging the server to get the host?