我想调试一个PHP网站,我有一个路由问题,我找不出来。Apache/PHP/.htaccess路由文件名到filename.php
这是一个定制的网站,大部分的请求都通过index.php文件
我遇到的问题是,直播服务器(Linux的/阿帕奇)的路由: http://www.sitename.com/cart
通过的index.php作为路由它应该是。
,但我的测试服务器(OSX /阿帕奇)上: http://www.sitename.com/cart
去直接http://www.sitename.com/cart.php
不通过的index.php
被路由我认为这件事情做的.htaccess文件(如下图),但我可以”弄清楚什么。另外.htaccess文件在两台服务器上都是相同的,所以我不明白为什么它的工作方式不同,任何帮助都非常感谢。
AddType application/x-httpd-php .html
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^robots.txt$ robots_ssl.txt
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^([^.]+)\.s?html$ /index.php?q=$1 [L,QSA]
RewriteRule ^([^.]+)\.s?htm$ /index.php?q=$1 [L,QSA]
RewriteRule ^([^.]+)\.s?xml$ /index.php?q=$1 [L,QSA]
RewriteRule ^([^.]+)\.s?asp$ /index.php?q=$1 [L,QSA]
RewriteRule ^([^.]+)\.s?aspx$ /index.php?q=$1 [L,QSA]
RewriteRule ^robots.txt$ /index.php?q=$1 [L,QSA]
RewriteRule ^([^.]+)$ /index.php?q=$1 [L,QSA]
RewriteRule ^admin/.*$ - [PT]
#php_flag display_errors off
php_value default_charset ISO-8859-1
php_flag magic_quotes_gpc on
php_flag magic_quotes_runtime off
虚拟主机文件如下:
<VirtualHost *:80>
DocumentRoot "/Users/jim/Sites/sitename.com/public_html"
ServerName sitename.com
ServerAlias www.sitename.com
<directory "/Users/jim/Sites/sitename.com/public_html/">
Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
AllowOverride All
Order allow,deny
Allow from all
</directory>
</VirtualHost>
是否安装了重写引擎? – Perry
它在其他网站上工作正常,它可能与虚拟主机有关 - 我编辑了问题以包含文件 – jx12345
虚拟主机与服务器上的虚拟主机几乎相同。因为我仍然认为在自己的计算机上重写有问题。 – Perry