Hi
I am experiencing a weird problem: I can access my website from the www. subdomain but not without.
I have looked at other solutions in the forum and couldn’t find something relevant. Any ideas what could be wrong?
Here is my .htaccess, nothing fancy it’s the default htaccess + force https.
Does it work without the forcing? It might be something do do with the way your sites DNS settings are configured.
Try doing the forcing as defined in the Kirby Secrets
The forcing didn’t seem to solve the issue. Actually, now the www- is also not working anymore.
Any chance that the config.php file have an impact on this issue ?
I wouldnt have thought so, php kicks in after the site config, and I dont think kirbies router can strip / force the www. What kind of server is it? Im assuming its properly configured with all the usual PHP and Apache stuff setup correctly. You need mod_rewrite
for rewrites.
Some shared hosts really limit what you can do with .htacess and php.ini.
It could be a problem with the CSP stuff in the top of you htaccess. Try rolling back the .htacess to the default Kirby and add back each rule you need one at a time to see which one upsets it.
I am running it on a OVH server (shared). However, the website was working days ago (it broke after I try to upgrade to 2.5.12, and when I roll-back it’s still not working)
I also have a kirby website working on a subdomain, both the www and non-www urls are working.
I copy/paste the folders Kirby, Panel, and the index and .htaccess for the working (subdomain) to the main domain; the issue is still here.
Look in your config.php
file(s) for differences.
It seems that I found the problem: the caching system.
From the config file, I have to remove c::set('cache',true); c::set('cache.autoupdate',true);
. If I enable it again, everything breaks.
However, I now have another issue, not sure if it’s directly related or not but there’s definitely something wrong with the www / non-www.
When I try to access a page with a custom route in the non-www subdomain (example), it’s working. When I try to access it in the www subdomain, it returns a 404 (example). Do you think it’s related?
(I know that I can force non-www, but it’s not really elegant, isn’t it? )
I think this is fishy, since you hardcode the “www” part somehow in your rewrite rules.:
RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ https://www.marcteyssier.com/$1 [R=301,L]
#RewriteRule ^panel/(.*) https://www.marcteyssier.com/panel/ [R=301,L]
This is what I have in my .htaccess:
RewriteEngine on
# rewrite www.example.com → example.com
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
I don’t force SSL redirects in my .htaccess as it didn’t work with my hosting.
I’m using c::set('ssl',true);
in the config instead.
TBH I really doubt caching has anything to do with redirect issues somehow 
I’ld make my redirects work first (from www->non-www or vice-versa).
@marcteys, if your website is available at both the www subdomain and without domain for the same content you have duplicate content issues that you should fix.
1 Like
Do you have access to the sites DNS records? ive still got a gut feeling that this is a DNS problem made worse by the .htacess. I think if you verify the settings for the domain itself, perhaps with help from OVH support, then the .htaccess should work.
It seems that this issue is fixed? However, currently the website is available under both the www and the non-www domain. You should really fix this and make sure that you redirect one to the other.