Jump to content

domain.com to go to https://www.domain.com/


Recommended Posts

Hi,

 

I know there is something in (1) ensuring all links on your site have the trailing slash (wasting server resources) and (2) ensuring you don't allow access to both www.domain.com and domain.com (probably SEO purposes).

 

I also want the site to be https/SSL only, across all pages.

 

I want to ensure everyone correctly views https://www.domain.com/. I'm guessing this is a .htaccess thing? I am on a cloud server so have no more control than that anyway.

 

If I currently go to domain.com on my site then it automatically adds the trailing slash (which I'm guess is why links should be to domain.com/ to prevent this wasteful server action), but if I type in domain.com/page it doesn't redirect (add the trailing /). Should it?

 

If I can ensure htaccess just redirects everyone to https://www.domain.com/page/ then I think that may be it. How would I do this?

Link to comment
Share on other sites

If I currently go to domain.com on my site then it automatically adds the trailing slash (which I'm guess is why links should be to domain.com/ to prevent this wasteful server action)

That's not a "wasteful server action". Not even the server doing it. It's your browser.

 

but if I type in domain.com/page it doesn't redirect (add the trailing /). Should it?

If you want it to.

 

If I can ensure htaccess just redirects everyone to https://www.domain.com/page/ then I think that may be it. How would I do this?

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.