Linux

Wordpress 永久連結到達 apache 404 而不是 wordpress 404.php 或它們各自的真實頁面。重定向或apache配置錯誤?

  • April 22, 2013

我剛剛完成了乾淨的 wordpress 安裝並設置了它的 .htaccess,就像他們說我應該做的那樣:

http://codex.wordpress.org/Using_Permalinks

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

當我嘗試訪問瀏覽器中的某個地址時,例如http://localhost:888/blog/我從伺服器收到 404 錯誤。我什至沒有被 wordpress 引導到 wordpess 自己的 404 頁面。

當我查看我網站的錯誤日誌時:

[Sat Apr 20 10:43:36 2013] [error] [client 127.0.0.1] File does not exist: /home/alan/projects/pin_wp/blog, referer: http://localhost:888/

所以這讓我想到我在某個地方搞砸了我的虛擬主機配置 - 因為我是那個領域的一個大菜鳥:

alan@alan:~/projects/pin_wp$ cat /etc/apache2/sites-enabled/localhost-pinwp 
Listen 888
<VirtualHost *:888>
   ServerAdmin webmaster@localhost

   DocumentRoot /home/alan/projects/pin_wp
   ServerName html

   <Directory />
       Options FollowSymLinks
       AllowOverride None
   </Directory>
   <Directory /home/alan/projects/pin_wp>
       Options Indexes FollowSymLinks MultiViews +Includes
       AllowOverride None
       Order allow,deny
       allow from all
       AddOutputFilter INCLUDES .html
   </Directory>

   ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
   <Directory "/usr/lib/cgi-bin">
       AllowOverride None
       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
       Order allow,deny
       Allow from all
   </Directory>

   ErrorLog ${APACHE_LOG_DIR}/error-pinwp.log

   # Possible values include: debug, info, notice, warn, error, crit,
   # alert, emerg.
   LogLevel warn

   CustomLog ${APACHE_LOG_DIR}/access-pinwp.log combined

   Alias /doc/ "/usr/share/doc/"
   <Directory "/usr/share/doc/">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride None
       Order deny,allow
       Deny from all
       Allow from 127.0.0.0/255.0.0.0 ::1/128
   </Directory>

</VirtualHost>

有人可以幫我解決這個問題,並指出我這次犯了什麼愚蠢的錯誤。

艾倫

好吧,我在沒有什麼幫助的情況下弄清楚了。

我從以下位置更改了 apache conf:

<Directory /home/alan/projects/pin_wp>
   Options Indexes FollowSymLinks MultiViews +Includes
   AllowOverride None
   Order allow,deny
   allow from all
   AddOutputFilter INCLUDES .html
</Directory>

<Directory /home/alan/projects/pin_wp>
   Options Indexes FollowSymLinks MultiViews +Includes
   AllowOverride all
   Order allow,deny
   allow from all
   AddOutputFilter INCLUDES .html
</Directory>

現在一切正常。

艾倫

引用自:https://serverfault.com/questions/501147