10.14 apache 域名跳转

1 [root@localhost ~]# /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]
即 其实括号里面是没有空格的
注释:
在这里插入图片描述

结果
[root@localhost ~]# curl -x127.0.0.1:80 -I testdomain.com
HTTP/1.1 301 Moved Permanently
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

猜你喜欢

转载自blog.csdn.net/weixin_46396109/article/details/109078772