Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

HTTPS - htaccess

+3 votes
62 views
asked Sep 5 in Q2A Core by Omsk

How correctly to edit https:// in .htaccess

Options -Indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

Q2A version: 1.7.5
commented Sep 6 by AlbertKa
How to properly configure the output in .htaccess http://site.com I do not want it to be http://www.site.com

How to delete WWW for url

2 Answers

+1 vote
answered Sep 6 by ProThoughts
commented Sep 6 by AlbertKa
does not work
+2 votes
answered Sep 6 by esqeudero

1) in .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourdomain.com/$1  [R,L]

RewriteCond %{HTTP_HOST} ^www\.yourdomain.com\.com$
RewriteRule ^/?$ "https\:\/\/yourdomain.com\.com\/" [R=301,L]

</IfModule>

2) Go to admin -> General

for site url type https://yourdomain.com/

commented Sep 6 by AlbertKa
When switching to categories and questions, error 404 appears
commented Sep 6 by esqeudero
check your theme files and qa-theme-base.php file search for http://  change them to https://
commented Sep 6 by AlbertKa
In this case, everything works. Is there no excess here?

Options -Indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://site.com/$1  [R,L]
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^/?$ "https\:\/\/site.com\.com\/" [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
...