0

私は次のURLを持っていますhttp://www.example.com/teams.php?team_id=12 このURLにしたいhttp://www.example.com/teams-pavilion-boys-varsity-soccer

私は次のコードを試しました

Options +FollowSymlinks    
RewriteEngine on    
RewriteRule ^teams-([0-9a-zA-Z]+)\.html$ teams.php?team_id=$1

私を助けてください。

前もって感謝します

4

2 に答える 2

0

これをチェックしてください:

http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html

team_nameの代わりにを渡すことをお勧めします。または、ID からteam_idを把握することもできます。team_name「町」「性別」「ランク」「スポーツ」など、必要なものをすべて渡します

RewriteEngine on
RewriteRule ^teams-([a-zA-Z0-9_-]+)$ teams.php?team_name=$1

または

RewriteEngine on
RewriteRule ^teams-([a-zA-Z0-9_-]+)-([a-zA-Z0-9_-]+)-([a-zA-Z0-9_-]+)-([a-zA-Z0-9_-]+)$ teams.php?team_town=$1&team_gender=$2&team_rank=$3
于 2012-08-31T17:29:09.540 に答える
-1
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -f [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule .* - [L]

RewriteRule ^(.*)$ [URLHERE] [NC]

これを見て

于 2012-08-31T17:25:21.453 に答える