2017-03-01 76 views
0

請幫我的RewriteCond.htaccess中的頁面塞read.php?蛞蝓=標題/標題

我有網站www.website.com/read.php?slug=my-page-title

我希望有重寫URL這樣www.website.com/my-page-title

這是我的.htaccess

RewriteEngine On 
RewriteCond %{THE_REQUEST} ^GET\ /read\.php\?slug=([^\s&]+) [NC] 
RewriteRule ^read\.php$ /%1? [R=301,L] 

RewriteRule ^/([^/]+)/?$ /read.php?slug=$1 [NC,L] 

它顯示了我404錯誤與上述規則。請協助

回答

0

由於RewriteRule的模式相對於當前目錄,您需要從規則中刪除前導斜槓。

RewriteRule ^([^/]+)/?$ /read.php?slug=$1 [L]