开发者

apache url rewriting for TheGamesDB.net

开发者 https://www.devze.com 2023-04-11 13:29 出处:网络
I\'ve come across a bit of 开发者_C百科a gap in my knowledge. I\'m trying to enable friendly (or friendly-er) urls on a site i develop for: http://thegamesdb.net

I've come across a bit of 开发者_C百科a gap in my knowledge.

I'm trying to enable friendly (or friendly-er) urls on a site i develop for: http://thegamesdb.net

For a more in-depth look at the current format of urls we have, look at the site link I just gave. But for a quick overview here's a couple of example urls:

http://thegamesdb.net/?tab=game&id=90&lid=1

http://thegamesdb.net/?tab=adminstats&statstype=topratedgames

http://thegamesdb.net/index.php?string=Sonic+the+Hedgehog&searchseriesid=&tab=listseries&function=Search

Does anybody know the appropiate code to configure a htaccess file to rewrite these in a more friendly manner? I've had a go myself but it just keeps blowing my mind and not working... apache mod_rewrite is installed.

In all honesty I'd be happy to just settle for "index.php" to be hidden and the "tab" parameter to be re-written, and at least that'd give me a little bit of code to start with.

Thanks in advance,

Alex :)


Here's a skeleton of what you can use/do:

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号