2017-03-02 8 views
-2

URLをproduct?p=$nameからproduct/$nameに変更するにはどうすればよいですか?特殊文字を削除する方法は、phpとhtaccsesのURLです

私は.htaccsesファイルを使用することに同意しましたが、それを理解できませんでした。

PHP

echo"<a href = 'product?p=$name'></a>"; 
+2

私が見つけたものを見てください! http://stackoverflow.com/questions/25080835/pretty-urls-with-htaccess – Jer

+3

[htaccess rewrite to query string]の重複が可能です。(http://stackoverflow.com/questions/1231067/htaccess-rewrite-for-query -string) – Pete

+0

[Pretty URLs with .htaccess](http://stackoverflow.com/questions/25080835/pretty-urls-with-htaccess)の可能な複製 – Swier

答えて

1

内のリンクは、再び.htaccessファイルを試してみてください。今回は次のように入力してください:

RewriteEngine On 
RewriteRule ^product/([^/]*)/$ /product.php?p=$1 [L] 

注:を変更しましたか?product.php? PHPファイルがある可能性が高いためです。

関連する問題