【发布时间】:2018-06-02 11:51:59
【问题描述】:
virtualhost 或 .htaccess 中的重定向 301 不适用于 php 文件。
我的环境: 阿帕奇 2.4 php-fpm 7.0
我的虚拟主机配置:
<VirtualHost *:80>
ServerAdmin xxx@example.com
DocumentRoot /pathto/www/
DirectoryIndex index.htm index.php index.html
ServerName www.example.com
<Directory "/pathto/www/">
RewriteEngine on
Redirect 301 /myfile.php "http://www.example.com/page"
Redirect 301 /contact "http://www.example.com/contacts.htm"
Include /pathto/www/.htaccess
</Directory>
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/php7.0-fpm.sock|fcgi://localhost/pathto/www/
</VirtualHost>
Redirect 301 /file.php 也在 .htaccess 中,但没有人在工作。 所有其他基于 uri 或别名的重定向规则都可以正常工作!?
帮助欣赏。
【问题讨论】: