2011-03-19 96 views
0

當我使用index.php?id = this-is-an-article頁面加載內容,當我使用/ articles/this-is-an-article頁面加載沒有任何內容,對我如何解決這個問題有任何想法?htaccess工作,但內容不加載

的.htaccess:

Options +FollowSymLinks 
RewriteEngine On 
RewriteBase/

# force www. in all requests 
RewriteCond %{HTTP_HOST} ^mysite\.net [NC] 
RewriteRule ^(.*)$ http://www.mysite.net/$1 [L,R=301] 

# enable hiding php extension 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php 
RewriteRule ^(.*)\$ $1.php 

RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteRule ^page/(\d+)*$ ./index.php?p=$1 

# index.php?id=this-is-an-article => /articles/this-is-an-article 
RewriteRule /articles/(.*) index.php?id=$1 [NC,L] 

在此先感謝。

+0

做一些調試輸出startes:''

和 – nitro2k01 2011-03-19 09:08:08

回答

0

擺脫主導斜線。最好的做法是用^開始像這樣的正則表達式,並以$結尾。

RewriteRule ^articles/(.*)$ index.php?id=$1 [NC,L] 
+0

的調試輸出我得到這個... 陣列([ID] =>這-是-AN-article.php /本 - 這是一篇文章)而這不是我想要的..因爲它不是一個.php文件,它應該從數據庫拉。 – Hugo 2011-03-19 09:47:38

+0

好的,我修好了。這是隱藏的PHP擴展,塞滿了它。 – Hugo 2011-03-19 10:12:41

相關問題