2016-06-10 58 views
0

WordPress的永久鏈接問題這是爲什麼樣域www.example.com/about-us不工作,即使我激活的.htaccess用的index.php

AddHandler php-stable .php 
# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

還當你還瀏覽該鏈接的WWW。 example.com/index.php/about-us它會將您重定向到這個www.example.com/about-us,它不起作用,但是當您瀏覽這個www.example.com/Index.php/about-us這就是該網址的工作時間。請幫忙。它主機上godaddy

回答

0

好像你有一個mod_rewrite問題與您的主機。在你的服務器允許調用它phpinfo.php而這個頁面在瀏覽器中寫入以下代碼在它

<?php 
    phpinfo(); 
?> 

打開並尋找mod_rewrite設置您可以創建一個PHP頁面。它需要永久工作。

現在,轉到您的WP Admin Panel -> Settings -> Permalink並選擇/post_name/ Wordpress將自動寫入.htaccess文件(只要它可以訪問它)。

如果您的服務器上未啓用mod_rewrite,除了聯繫您的託管服務提供商以啓用它之外,沒有辦法。它是由所有託管服務提供商啓用,您仍然必須使用phpinfo進行交叉檢查。

以下是爲WordPress

# 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 

一個完全有效的.htaccess文件同時確保apache.conf被配置爲通過.htaccess文件覆蓋。 Apache設置如AllowOverride none;確保.htaccess不受尊敬。

0

按照你解釋查詢,我想建議你

WP Admin Panel -> Settings -> Permalink

然後選擇在/post_name/

前面的單選按鈕,然後去WP Admin Panel -> Appearance -> Menus

現在檢查您是否有菜單中使用的所有頁面,或者是否有您使用過的任何自定義鏈接?

還要檢查你的.htaccess

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php 
</IfModule> 

# END WordPress