を変更:プリティURL私は、以下のものを使用してachiveすることができ、かなりurlで変数を渡すしようとしています変数seporator
私.htaccess
ファイル内
domain.com/exercises/lunge+with+dumbells
そして、この:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9+]+)$ index.php?exercise=$1
RewriteRule ^([a-zA-Z0-9+]+)/$ index.php?exercise=$1
は、PHPでアクセスされます:
$urlVars = $_GET["exercise"];
しかし、私はこのように読むために私のURLを必要とする:
domain.com/exercises/lunge-with-dumbells
私はこれが
exercises/?exercise=lunge-with-dumbells
と、このPHP関数を使って仕事を得ることができます:
$urlVars = $_GET["exercise"];
$newString = str_replace("-", " ", $urlVars);
しかし、私は考え可変の文字列を持つかなりのURLのように、+
-
で区切られています
多くのありがとうございます。
変更: