[Apache 2] 從 domain.name 重定向至 www.domain.name
- 2023.03.15
- Apache2
sudo nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80> ServerName domain.name Redirect permanent / http://www.domain.name/ </VirtualHost> <VirtualHost *:80> ServerName www.domain.name # real server configuration ... </VirtualHost>
-
sudo apachectl configtest
→ Syntax OK如果沒有sudo 可能因為權限不足無法存取
而出現 AH00526:
SSLCertificateFile: file ‘/etc/letsencrypt/live/a1go.ai/fullchain.pem’ does not exist or is empty -
sudo systemctl restart apache2
Last Updated on 2023/10/24 by A1go