我想調試一個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