I want to redirect from www to non www version of my custom domain. How can I do that in divhunt?
Currently we don’t have redirect manager, but it’s the important feature. We will be adding it very soon. Thanks for patience.
I hope you guys will bring this feature ASAP because right now I have two versions of my website one with www and the second without www which will create duplicate content issues.
Happy to see the improvements.
You can do it with a small JS script BUT it won’t address the 301 issue and duplicate versions to the Googlebot. You might also get some minor speed issues using a script but it could be a solution until we have a native serverside 301 redirect available. This is also a “hack” if you have issues with one or the other version of your site.
I second the importance of Divhunt supporting this for both SEO reasons and speed.
It is not recommended as a first choice, but google does recognize JS redirects.
Chat GTP code…
if (window.location.hostname.startsWith("www.")) {
let url = window.location.protocol + "//" + window.location.hostname.slice(4) + window.location.pathname;
window.location.replace(url);
}
Yes, I know JS redirection is not recommended. Okay, I applied the js redirection code that you sent and it is working for now. I will change it when you introduce redirection functionality.
Thanks for the quick responses and updates.
This feature is live now, you can manage wether you want www, non-www or both options at Divhunt dashboard.
https://www.divhunt.com/projects
Only works with custom domains.
hey Dejan
In the new dashboard, this feature doesn’t seem to be working correctly. It doesn’t save the setting. Is that possible? I launched a new website today, and for SEO, it is very important that this is already set correctly.
→ And I also believe it affects how the sitemap.xml is generated, correct?
On my new site, the sitemap is now being generated without ‘www.’, even though I want the URL to always be ‘www.domainname.com’, so with ‘www.’.