2012-04-24 51 views
0

它向我顯示一個錯誤頁面。也許我的網站有問題,你覺得怎麼樣? 有在我的網站的網址:www.mywebsite.com/picture.php?1 ,我想改變它的東西是這樣的:www.mywebsite.com/picture/1當我更改鏈接時,用htaccess創建SEO友好的URL

這裏是我的.htaccess

RewriteEngine on 
rewritecond %{http_host} ^website.com [nc] 
rewriterule ^(.*)$ http://www.mywebsite.com/$1 [r=301,nc] 

RewriteRule ^contact\/?$ contact.php [L] 
RewriteRule ^terms\/?$ terms.php [L] 

**RewriteRule ^picture/(.*)/$ picture.php?$1 [L]** 

請幫忙, 我不知道是什麼問題。

回答

1

嘗試增加

<base href="www.mywebsite.com" /> 

在你的頁面的頂部,這可能工作。

編輯:使用此重寫規則

RewriteRule picture/(.*)/$ /picture.php?$1 [L, NC] 
+0

還是一樣。 – 2012-04-24 12:07:32

+0

@YarikSkovorodko,嘗試使用我剛剛編輯進我的文章的重寫規則。 – 2012-04-24 12:20:09

+0

它現在正在執行內部服務器錯誤 – 2012-04-24 12:31:19

0

假設你的htaccess作品的第一部分,用下面的更換你的最後一行

嘗試:

RewriteRule ^picture/(.*)$ /picture.php?$1 [NC] 
+0

現在它給了我一個錯誤從我的腳本。這裏是我的腳本中的代碼:mysql_query(「SELECT * FROM database WHERE id = $ id」)或die(「Picture does not exist。」)看起來像不能從我的數據庫中檢索「id」。 – 2012-04-24 12:36:07

+0

'RewriteRule^picture /(.*)$ /picture.php?id=$1 [NC]' 並添加'$ id = $ _GET ['id'];'在mysql語句之上 – QQping 2012-04-24 21:56:49