【发布时间】:2016-04-24 06:25:31
【问题描述】:
更新 - 好的,谢谢大家的测试,真的很有帮助。代码很好。我的问题是没有绝对的“/”链接。 (由于从 public_html 文件夹移动)。
我现在只有 2 个问题。
1.) 将“^achilles”替换为“^([0-9a-zA-Z_-]+)”,缩略图不会出现(参数数据没有携带???)
2.) 我怎样才能让http://funkygames.co/games/achilles/achilles/1 变得更短像http://funkygames.co/games/achilles 或者参数是绝对强制性的。
# Turn Rewrite Engine On
RewriteEngine on
# Set the base to /games/ so we need not include it in the rules
RewriteBase /games/
#Rewrite for achilles.php?games_path=xxxxxxxxxx.yyy&category_id=zzz
RewriteRule ^achilles/(.*)/([0-9]+) $1.php?games_path=$1.swf&category_id=$2 [NC,L]
我在哪里学到的:www.youtube.com/watch?v=1pbAV6AU99I
已解决!谢谢你们。 解决方案:
# Turn Rewrite Engine On
RewriteEngine on
# Set the base to /games/ so we need not include it in the rules
RewriteBase /games/
#Rewrite for achilles.php?games_path=xxxxxxxxxx.yyy&category_id=zzz
RewriteRule ^([0-9a-zA-Z_-]+)/([0-9]+) $1.php?games_path=$1.swf&category_id=$2 [NC,L]
www.funkygames.co/games/achilles/1
【问题讨论】:
-
游戏文件夹必须在 public_html 文件夹中。不确定您的措辞是否是这种情况。
标签: php .htaccess url url-rewriting clean-urls