Not*_*aeL 8 scripting httpd.conf redirect virtualhost apache-2.2
为什么??
<VirtualHost *:80>
ServerAdmin admin@mydomain.com
DirectoryIndex index.php
<If "%{SERVER_PROTOCOL} != 'HTTPS'">
Redirect / https://www.mydomain.com:443/
</If>
.....
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
保存,然后重启:
sudo /etc/init.d/apache2 restart
Syntax error on line 4 of /etc/apache2/sites-enabled/000-default:
Invalid command '<If', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
Run Code Online (Sandbox Code Playgroud)
“如果”不是 Apache 理解的东西(在 2.3 版之前)。你可能应该看看 mod_rewrite
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://example.com:443/$1 [R,L]
Run Code Online (Sandbox Code Playgroud)
要找到您的 apache 版本,您可能可以使用: apache2 -v
| 归档时间: |
|
| 查看次数: |
14601 次 |
| 最近记录: |