Apache httpd不会更新到301redirectconfiguration

我在更新apache服务器(httpd,rhel)中以前的redirect时遇到问题。 我曾经有过:

RedirectMatch 301 ^/apidocs/ /old/specific/path/apidocs/ 

哪些工作。

我把它改成:

 RedirectMatch 301 ^/apidocs/ /new/specific/path/apidocs/ 

现在它不起作用。 也就是说,当我尝试点击简单的http:// <host> / apidocs url时,我在响应头文件中获得了一个具有旧的redirect位置的301,在浏览器中跟着一个404,当它尝试从旧的位置。 httpd错误日志证实浏览器试图获取旧的目录:

 File does not exist: /var/www/html/old 

service httpd reloadservice httpd force-reload仅产生以下单行输出:

 Reloading httpd: 

…所以这可能是成功的。 也,

(1)httpd启动时,其错误日志没有任何投诉。
(2)运行apachectl configtest生成Syntax OK
(3)运行httpd -t生成Syntax OK
(4)我停下来“优雅”地开了几次httpd,都无济于事。
(5)我试过用apachectl -k stop / start,无济于事。

(6)我现在也尝试使用htcacheclean清除caching,无济于事。
在这里值得注意的是,以前尽pipemodcaching和modcaching磁盘模块被加载,没有configurationCacheRoot等,因此我添加了以下内容:

 CacheEnable disk / CacheRoot "/var/cache/httpd" CacheDirLength 2 CacheDirLevels 2 

…随后validation它正在填充和清除它与htcacheclean。

还有什么地方可以将这个陈旧的301数据永久化?

谢谢! 汉斯

首先,你需要解决语法错误,所以运行httpd -t ,像这样(echo部分除外),这样你可以找出哪个configuration文件包含语法错误:

 [root@wcmisdlin02 conf.d]# echo blah >> php.conf [root@wcmisdlin02 conf.d]# httpd -t AH00526: Syntax error on line 33 of /etc/httpd/conf.d/php.conf: Invalid command 'blah', perhaps misspelled or defined by a module not included in the server configuration [root@wcmisdlin02 conf.d]# 

根据mod_alias – Apache HTTP服务器版本2.4 ,你的RedirectMatch似乎很好。 你正在访问正确的虚拟主机?

…所以“答案”是问题的前提是错误的。 也就是说,Apache httpd正在正确地完成它的工作。 真正的问题是服务器上的httpd和我的本地机器之间有一个caching层。 我拿这个证据来certificate:
1.从本地机器执行的wget被redirect到旧的redirectURL,而
2.从服务器执行的wget被正确地redirect到新的redirecturl,
前者的访问日志如下所示:

 "GET /old/specific/path/apidocs/ HTTP/1.1" 404 

而后者产生:

 "GET /apidocs/ HTTP/1.0" 301 "GET /new/specific/path/apidocs/ HTTP/1.0" 200