0 レビュー
1 回答
.htaccess-htaccess rewriteサブディレクトリのgetパラメータを取得し、phpで取得します
example.com/subdir/file.php?param=123
をexample.com/subdir/file/123
書き換えて、phpで値を取得してみます。
メインディレクトリの.htaccess
RewriteRule ^/subdir/([^/.]+)/?$ /subdir/file.php?param=$1 [L,NC,QSA]
書きましたが、機能していません。
わからない
0
レビュー
答え :
解決策:</ h4>
このルールはサイトルート.htaccess:</ p>で試すことができます
RewriteRule ^(subdir/[\w-]+)/([\w-]+)/?$ $1.php?param=$2 [L,NC,QSA] </code></pre>
- \n
file</code> part also after
と一致する必要がありますsubdir/</code></li>
file</code> part also after subdir/</code></li>
- キャプチャグループと後方参照を使用して、同じテキストが繰り返されないようにします</ li>\n
- 正規表現パターンの先頭の
/</code> in regex pattern is not matched in
.htaccess</code></li>
subdir/</code>.</li> </ul>
他の.htaccessがないことを前提としています。subdir/</code>.</li> </ul>
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。