简体   繁体   English

符号链接在Apache 2.2上不起作用

[英]Symbolic links not working on apache 2.2

I am experiencing a strange issue regarding displaying symbolic links. 我在显示符号链接时遇到一个奇怪的问题。 I have copied existing working code from my development environment, to a test environment. 我已将现有工作代码从开发环境复制到测试环境。 Looking at the code it should work. 查看代码,它应该可以工作。 This makes me think that the issue might be elsewhere but I do not know where to look. 这使我认为问题可能在其他地方,但我不知道在哪里寻找。

  • I am using Apache 2.2 on a CentOs 5.8 machine 我在CentOs 5.8机器上使用Apache 2.2

  • All files and folders under document root including root folder is owned by apache apache拥有文档根目录下的所有文件和文件夹,包括根文件夹

This are the lines of code in the vhost file 这是vhost文件中的代码行

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([a-zA-Z0-9_-]+)/?$ /$1.php [QSA]

When I go to http://example.com/home 当我转到http://example.com/home时

I get this error in the error log: 我在错误日志中收到此错误:

File does not exist: /var/www/my_document_root_folder/home 文件不存在:/ var / www / my_document_root_folder / home

If I add .php to the URL it works: 如果我将.php添加到URL,它将起作用:

http://example.com/home.php http://example.com/home.php

The exact same RewriteRule works fine in my development environment. 完全相同的RewriteRule在我的开发环境中可以正常工作。 Could the issue be somewhere else and not in the actual RewriteRule? 问题可能出在其他地方而不是实际的RewriteRule中吗?

I copied my development vhost file to this test environment. 我将开发虚拟主机文件复制到了该测试环境。 I only changed the ServerName, DocumentRoot, ErrorLog paths etc. 我只更改了ServerName,DocumentRoot,ErrorLog路径等。

Any help is much appreciated, it's driving me bonkers. 非常感谢任何帮助,这使我疯狂。

-M -M

I have answered my own question. 我已经回答了我自己的问题。 It turns out that I made a spelling error on one of the the paths. 原来,我在其中一条路径上犯了拼写错误。 Once I fixed that everything works fine. 一旦我修复一切正常。 Feeling a bit stupid right now :( 现在感觉有点愚蠢:(

-M -M

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM