一切正常,直到我发现一个bug,我的服务器无法在127.0.0.1上访问他自己的服务。我不确定是否相关,但是当我在Internet中键入127.0.0.1时,它会等待,然后说www.127.0.0.1是不可触及的。我确实加了'www.‘最近强制执行,但现在我将这个脚本更改为'xxx.‘’。而不是“www.”它仍然将我重定向到www.127.0.0.1,我的其他网站被重定向到'xxx.‘’。
这是httpd.conf:
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin admin@your-domain.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.net
ServerName 127.0.0.1
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "c:/htdocs"
DocumentRoot "c:/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride none
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "c:/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>这是httpd-vhost.conf:
<VirtualHost 127.0.0.1:80>
DocumentRoot c:/htdocs
ServerName 127.0.0.1
ServerAlias www.127.0.0.1 localhost www.localhost
ErrorLog logs/example-intern-error.txt
CustomLog logs/example-intern-access.txt common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/htdocs
ServerName sa-arp.net
ServerAlias www.example.net www.example.com example.com
ErrorLog logs/example-error.txt
CustomLog logs/example-access.txt common
RewriteEngine On
RewriteCond %{HTTP_HOST} !^xxx\. [NC]
RewriteRule ^(.*)$ http://xxx.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>我尝试了所有可能的组合,似乎没有任何效果。
请帮帮我,我没有资源和耐心!
谢谢,
rt-2
发布于 2017-07-14 17:11:14
答案很简单,问题是,我使用它是因为我在服务器上测试服务,不想安装新程序。好吧,火狐完成了工作,起了作用,问题是测试方法。rt-2
编辑:问题不是互联网浏览器,问题是我创建了301重定向,这意味着浏览器记住了我告诉他的第一件事,然后我所有的测试对于我已经测试过的每个域都是徒劳的。(是的,这很令人沮丧)。我更新了这篇文章,以防有人有类似的代码和我的问题。
https://stackoverflow.com/questions/45107970
复制相似问题