我正在php
其實我需要SEO搜索查詢腳本我已經寫在文件夾中調用newtheme
(文件夾名稱)。當我嘗試做搜索引擎優化網址不工作時沒有發現執行搜索時顯示。請檢查我的代碼並糾正我在哪裏做錯了。搜索引擎友好的網址搜索查詢字符串在PHP中使用htaccess
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteCond %{QUERY_STRING} ^searchword=([^&]+)$
RewriteRule ^results.php$ /newtheme/%1/? [L,R=301]
在我results.php
if($_GET['searchword'];
{
$q= mysql_real_escape_string($_GET['searchword']);
$sql=mysql_query("select * from table where keyword='$q'");
$row=mysql_fetch_array($sql);
echo $row['title'];
}
?>
htaccess文件裏放在我的文件夾newtheme。腳本文件夾localhost/newtheme/.htaccess
你應該閱讀關於SQL注入和'mysql_ *'函數。 http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php – sshow
你需要提供更多的細節,如什麼是你的鏈接網址?什麼是.htaccess等的位置 – anubhava
@anubhava搜索表單代碼
– user3164590