xProteuSx Posted March 27, 2017 Share Posted March 27, 2017 What a mess! And so much time trying to figure out how to fix it, all to no avail. As a last resort, I draw on you guys' collective knowledge. Please help! I've got the following issue. http://www.mysite.com/forums --> works! https://mysite.com/forums --> works! https://www.mysite.com/forums --> DOES NOT WORK! The forums are SMF and have issues with SSL. That having been said, if I can change all links that have www in them and link to either the forums directory or a sub-directory of forums and strip out the www then everything would work great. I cannot find a solution for this specific problem. FYI - the file structure for the site is relative. It seems to me that the simplest fix would be to do this: if URL contains "/forums" and "www" remove the "www". An even better fix would be to do this only when HTTPS is on. Thank you guys in advance. Quote Link to comment Share on other sites More sharing options...
requinix Posted March 27, 2017 Share Posted March 27, 2017 Would you rather have the inconsistent www/no www thing or fix the SSL problem? Quote Link to comment Share on other sites More sharing options...
xProteuSx Posted March 28, 2017 Author Share Posted March 28, 2017 I would like to implement the "inconsistent" www/no www thing while I work no the SSL problem. I am not sure that the SSL issue can be fixed, as SMF is known to have issues around SSL. I am looking for a proper fix, but in the meantime my forums are messed up for a large percentage of visitors. Quote Link to comment Share on other sites More sharing options...
requinix Posted March 28, 2017 Share Posted March 28, 2017 Surprised it's so difficult. I guess SMF doesn't have a way of setting a base URL like "https://www.example.com/forums/"? I have heard horror stories about SMF... Oh well. And you know that your site should be either www or no-www, right? Supporting both isn't good. Rewrite https+www to https? RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} =www.mysite.com RewriteRule ^/?forums(/|$) https://mysite.com%{REQUEST_URI} [L,R=301]Note that SMF must be able to have its form POST to the correct URL - if it does not then the forums may break and URL rewriting can't fix it. Quote Link to comment Share on other sites More sharing options...
xProteuSx Posted March 28, 2017 Author Share Posted March 28, 2017 (edited) Thank you for your reply. The code you've provided does not work -- still having the same issue. Also, why is it not good to support www. and non-www.?? Seems to me this is a good idea, because it appears as though Google Webmaster Tools encourages separate listings for www. and non-www. indexing, as well as a separate listing for https indexing. Am I mis-understanding something there? Edited March 28, 2017 by xProteuSx Quote Link to comment Share on other sites More sharing options...
requinix Posted March 28, 2017 Share Posted March 28, 2017 Did you know to put that in an .htaccess at the root of the site? Do you also have a RewriteEngine in there, which is necessary for any mod_rewrite stuff to work? I'm not sure about it "encouraging" separate listings. To search engines, example.com and www.example.com are two sites. If you have the same content on both then that gets both penalized for duplicate content. Look at what other sites do when you go to www and no-www versions - they (the ones who know what they're doing) will redirect you to one version. Quote Link to comment Share on other sites More sharing options...
xProteuSx Posted March 30, 2017 Author Share Posted March 30, 2017 requinix, Yes, I do know how to add this code to the .htaccess, and I do have RewriteEngine on. Still, the code you have provided does not work, and I can't figure out why or what to do. As per the separate listings, this is the message (direct copy and paste) I get from Google Webmaster Tools when I "add a new property" (ie. domain/website): ----------------------- Add all your website versions Make sure you add separate Search Console properties for all URL variations that your site supports, including https, http, www, and non-www. ---------------------------- If I am doing something wrong, I'd like to know. All hail master "Google!" It almost seems that, according to that message you should add the following versions of your site: http with www http without www https with www https without www It seems ridiculous, but that's what I've understood. Yes, I do know how to add this code to the .htaccess, adn I do have RewriteEngine on. Quote Link to comment Share on other sites More sharing options...
kicken Posted March 30, 2017 Share Posted March 30, 2017 That message is because the different variations of the URL are treated as different sites, so if you want to see all the stats you have to add them all. That's a situation you generally want to avoid, and you do that by settling on one version of your URL and redirecting everything else to that single version. See Use canonical URLs and Set your preferred domain. Once you've settled on one version of your URL and redirect everything else you can add just that version and track all the stats. Quote Link to comment Share on other sites More sharing options...
xProteuSx Posted March 31, 2017 Author Share Posted March 31, 2017 kicken, thank you for your post. The Site Settings, however, only allow a selection of www. or non-www. domains, and specifies nothing in regards to https. I had a Mod Rewrite setup that redirected all traffic to https://www.mydomain.com/... but it seemed to have reduced my traffic significantly. I re-listed three versions of my site at Webmaster Tools (http://www.mysite.com, https://www.mysite.com, and http://mysite.com) and traffic went up for a while, and its dropped off significantly again. What do you suggest? I would like to redirect everything to https://www.mysite.com. Should I do this using the .htaccess and mod_rewrite, and keep only the same version up and running at Google Webmaster Tools? My content changes very frequently, and I hate having to resubmit three sets of sitemaps for three versions of the site ... BTW - thank you very much you guys (requinix and kicken) Quote Link to comment Share on other sites More sharing options...
kicken Posted March 31, 2017 Share Posted March 31, 2017 If you want https + www then you will want to redirect everything else to that URL. How exactly you do that would depend a bit on what kind of configuration you want to use. I configure all my sites manually so what I do is have the http vhost do a simple redirect to the https vhost, then in the https vhost fix the www vs non-www via mod-rewrite. For example: <VirtualHost *:80> ServerName example.com ServerAlias www.example.com Redirect permanent / https://www.example.com/ </VirtualHost> <VirtualHost *:443> ServerName example.com ServerAlias www.example.com RewriteEngine On #Force www RewriteCond %{HTTP_HOST} !=www.example.com RewriteRule ^/(.*) https://www.example.com/$1 [QSA,R=301,L] </VirtualHost> If you're using some software package to manage your hosting configuration you'll have to work with it to do your redirecting. If you have to do it all using mod_rewrite it'd be something like this (i think, not tested) RewriteCond %{HTTPS} !=on [OR] RewriteCond %{HTTP_HOST} !=www.example.com RewriteRule ^/(.*) https://www.example.com/$1 [QSA,R=301,L] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.