我的网站(MAMP)的本地版本似乎得到了与我的 Ubuntu 服务器不同的 mod_rewrite 结果。
例如,当我输入
它应该在内部转换为
http://gymtracker.in/articles.php
对于服务器,但它只是抛出 404 错误。
我已经确认我的 .htaccess 文件正在被读取,它在放置垃圾时会引发错误。
这是重写日志的输出
`110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/articles.php -> articles.php
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] applying pattern '^article/([a-zA-Z0-9-]*)' to uri 'articles.php'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/articles.php -> articles.php
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (3) [perdir /var/www/] applying pattern '(.*)' to uri 'articles.php'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (4) [perdir /var/www/] RewriteCond: input='/var/www/articles.php' pattern='!-d' => matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (4) [perdir /var/www/] RewriteCond: input='/var/www/articles.php' pattern='!-f' => not-matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cd0a0/subreq] (1) [perdir /var/www/] pass through /var/www/articles.php
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/favicon.ico -> favicon.ico
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] applying pattern '^article/([a-zA-Z0-9-]*)' to uri 'favicon.ico'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/favicon.ico -> favicon.ico
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (3) [perdir /var/www/] applying pattern '(.*)' to uri 'favicon.ico'
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (4) [perdir /var/www/] RewriteCond: input='/var/www/favicon.ico' pattern='!-d' => matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (4) [perdir /var/www/] RewriteCond: input='/var/www/favicon.ico' pattern='!-f' => not-matched
110.175.32.14 - - [21/Aug/2013:00:44:38 +1000] [gymtracker.in/sid#7f6c27b8d430][rid#7f6c279cf0a0/initial] (1) [perdir /var/www/] pass through /var/www/favicon.ico
这也是我的 .htacess 文件的输出
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^article/([a-zA-Z0-9-]*) /article.php?title=$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
当配置看起来相同时,我只是不确定为什么它在我的本地 Web 服务器上运行,而不是在我的远程服务器(ubuntu)上运行。