fle*_*age 4 apache url-rewriting
在我的知识中,我遇到了一点差距.
我正在尝试在我开发的网站上启用友好(或友好)网址:http://thegamesdb.net
要更深入地了解我们当前的网址格式,请查看我刚才提供的网站链接.但是为了快速概述,这里有几个示例网址:
http://thegamesdb.net/?tab=game&id=90&lid=1
http://thegamesdb.net/?tab=adminstats&statstype=topratedgames
有没有人知道适当的代码配置htaccess文件以更友好的方式重写这些?我自己有一个去,但它只是不停地吹我的思绪而不工作......安装了apache mod_rewrite.
老实说,我很高兴只能解决隐藏的"index.php"和要重写的"tab"参数,至少我会给你一些代码.
提前致谢,
Alex :)
以下是您可以使用/执行的操作的框架:
RewriteEngine On
RewriteBase /
# http://thegamesdb.net/?tab=game&id=90&lid=1 => http://thegamesdb.net/tab/games/90/1
RewriteRule ^tab/games/([0-9]+)/([0-9]+)(/?)$ index.php?tab=game&id=$1&lid=$2 [NC,QSA,L]
# http://thegamesdb.net/?tab=adminstats&statstype=topratedgames => http://thegamesdb.net/admin/stats/top-rated-games
RewriteRule ^admin/stats/([a-z0-9\-]+)(/?)$ index.php?tab=adminstats&statstype=$1 [NC,QSA,L]
# http://thegamesdb.net/index.php?string=Sonic+the+Hedgehog&searchseriesid=&tab=listseries&function=Search => http://thegamesdb.net/list-series/search/Sonic+the+Hedgehog/
RewriteRule ^([a-z0-9\-\.\+\ ]+)/search/([a-z0-9\-\.\ \+]+)(/?)$ index.php?tab=$1&string=$2&searchseriesid=&function=search [NC,QSA,L]
# http://thegamesdb.net/index.php?string=Sonic+the+Hedgehog&searchseriesid=&tab=listseries&function=Search => http://thegamesdb.net/list-series/search/Sonic+the+Hedgehog/12
RewriteRule ^([a-z0-9\-\.\+\ ]+)/search/([a-z0-9\-\.\ \+]+)/([0-9]+)(/?)$ index.php?tab=$1&string=$2&searchseriesid=$3&function=search [NC,QSA,L]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
78 次 |
| 最近记录: |