RewriteRule ^articles\.php\?id=([0-9]+)$ article-a$1.html [R=301,L]
article-a {ID} .htmlを指すarticles.php?id = 1211のようなすべてのリンクが欲しいのですが、どうすればこれを実現できますか?このルールの何が問題になっていますか?
RewriteRule ^articles\.php\?id=([0-9]+)$ article-a$1.html [R=301,L]
article-a {ID} .htmlを指すarticles.php?id = 1211のようなすべてのリンクが欲しいのですが、どうすればこれを実現できますか?このルールの何が問題になっていますか?
書き換えルールでクエリ文字列と照合することはできません%{QUERY_STRING}
。条件で変数と照合し、後方参照を使用する必要があり%
ます。
RewriteCond %{QUERY_STRING} ^id=([0-9]+)$
RewriteRule ^articles\.php$ article-a%1.html [R=301,L]
次の使用、
RewriteRule ^articles.php?id=([0-9]+)$ article-a$1.html