10.14 apache 域名跳轉
阿新 • • 發佈:2020-10-15
1 [[email protected] ~]# /usr/local/apache2.4/bin/apachectl graceful
AH00526: Syntax error on line 43 of /usr/local/apache2.4/conf/extra/httpd-vhosts.conf:
RewriteRule: bad flag delimiters
原因 很簡單 43行語法錯誤 RewriteRule ^/(. *)$ http://www.testdomain.com/$1 [R=301,L]
即 其實括號裡面是沒有空格的
註釋:
結果
[[email protected] ~]# curl -x127.0.0.1:80 -I testdomain.com
Date: Wed, 14 Oct 2020 09:17:19 GMT
Server: Apache/2.4.43 (Unix) PHP/5.6.30
Location: http://www.testdomain.com/
Content-Type: text/html; charset=iso-8859-1
可以看見狀態碼301,跳轉的網址是www.testdomain.com