Mod rewrite

software development

#1

can someone pls help me?
i want to use mod rewrite on my site.

heres my dynamic url

http://mysite.com/index.php?id=sport&cat=boxing&page=3

i want my url to be like
http://mysite.com/sport/boxing/3.html

heres what will happen…
first it will load the sport.php

./inc/sport.php

then it will load the boxing.php

…/allsports/boxing.php

then it will load the page
…/allsport/boxing/3.php

hope someone will help me.
tia!


#2

[quote]can someone pls help me?
i want to use mod rewrite on my site.

heres my dynamic url

http://mysite.com/index.php?id=sport&cat=boxing&page=3

heres what will happen…
first it will load the sport.php

./inc/sport.php

then it will load the boxing.php

…/allsports/boxing.php

then it will load the page
…/allsport/boxing/3.php

hope someone will help me.
tia![/quote]
That needs to be done using PHP, not mod_rewrite.

Something like

if ($_GET[‘id’] == ‘sport’) {
include(realpath(’/home/username/inc/sport.php’));
}

if ($_GET[‘cat’] == ‘boxing’) {
include(realpath(’/home/username/allsports/boxing.php’));
}

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#3

iam sorry i edited my question. i added up.

“i want my url to be like
http://mysite.com/sport/boxing/3.html

its mod rewrite.


#4

[quote]heres my dynamic url

http://mysite.com/index.php?id=sport&cat=boxing&page=3

i want my url to be like
http://mysite.com/sport/boxing/3.html
[/quote]

RewriteRule ^sport/(.+)/(\d+).html /index.php?id=sport&cat=$1&page=$2

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#5

thanks
i have one problem more
i also have a link like this

http://mysite.com/viewimage.php?img=img95.imageshack.us/img95/2627/filenameofimage&cat=hi&f=Eagles

ive tried to use
http://mysite.com/img95.imageshack.us/img95/2627/filenameofimage/hi/Eagles.html

with mod rewrite
RewriteRule ^([^/]+)/([^/]+)/([^/]+).html$ /viewimage.php?img=$1&t=$2&f=$3

but iam getting 404 error

thanks for the help.


#6

anyone?


#7

Try asking AskApache.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#8

Try

RewriteRule ^([b].+[/b])/([^/]+)/([^/]+)\.html$ /viewimage.php?img=$1&[b]cat[/b]=$2&f=$3


[color=#000000]DreamHost Promo Code[/color]: [color=#CC0000]Save $50[/color] with the promo code DREAMTEAM


#9

kiko8, doelman came up with the same thing I did…

RewriteEngine On RewriteBase / RewriteRule ^(.+)/([^/]+)/(.+)\.html$ /viewimage.php?img=$1&cat=$2&f=$3 If you still need help goto htaccessElite and ask there.

Boooooooost DreamHost Referrals!