Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のようなクエリ文字列があります。
product_details.php?id=17&name=dhruba
これを次のように変更するにはどうすればよいですか:
product_details/dhruba
データベースからタイトル付きのIDをリダイレクトする方法を教えてください。IDを使用してすべての計算を行っています。
.htaccess ファイルに mod_rewrite ルールが必要です。次のようになります。
Options +FollowSymLinks RewriteEngine on RewriteRule ^product_details/(.*)$ product_details.php?name=$1 RewriteBase /
ID も必要な場合は、それをパラメーターとして書き換えルールに渡すことをお勧めします。