Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Apache configure domain name 301 jump

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Configure domain name 301 jump

When there are two domain names, we need to set a primary domain name (jump the secondary domain name to the primary domain name). The operation command is as follows:

Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf

Add the following line under # CustomLog "logs/dummy-host.example.com-access_log" common:

RewriteEngine on

RewriteCond% {HTTP_HOST} ^ www.aaa.com$

RewriteRule ^ / (. *) $http://www.test.com/%1 [Rust 301m L]

Save exit

# Redirect 301 permanent redirect domain name jump must use 301, which is good for the browser

Jump 302 indicates temporary redirection

Apachectl-M # observe whether the rewrite_module module is loaded

Apachectl-t

Apachectl restart

Curl-x192.168.1.113: 80 www.aaa.com/dsgsdgsdfg-I # test whether the domain name jumps normally

If there are more than two domain names, the operations are as follows:

Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf

Add:

I

RewriteCond% {HTTP_HOST} ^ www.aaa.com$ [OR]

RewriteCond% {HTTP_HOST} ^ www.bbb.com$

Save exit

Apachectl-t

Apachectl restart

Curl-x 192.168.1.113: 80 www.bbb.com/asllsdfsf-I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report