Apache2-.htaccess将全部重定向到https://www

Apache2-.htaccess将全部重定向到https://www,apache2,Apache2,我需要一个htaccess规则,它可以重定向所有类型的页面打开,比如httpS://WWW.oursite.com 你能给我那种规则吗 <IfModule mod_rewrite.c> ErrorDocument 404 /page-404.php RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d Re

我需要一个htaccess规则,它可以重定向所有类型的页面打开,比如httpS://WWW.oursite.com

你能给我那种规则吗

<IfModule mod_rewrite.c>
ErrorDocument 404 /page-404.php
RewriteEngine On

        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule .+ - [L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\s([^\s]+)\.php\s [NC]
RewriteRule .* %1.html [R=301,L]

# make sure .php file exists for the requested .html file
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)\.html$ $1.php [L,NC]
</IfModule>
提前谢谢

简洁明了:

<ifmodule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</ifmodule>

您尝试过什么,包括阅读文档和/或手册页?