0

我有以下网址http://www.example.com/teams.php?team_id=12 我希望这个网址是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而不是或者你可以从idteam_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 回答