Page 1 of 1

search-friendly url

Posted: Fri Jun 22, 2007 10:25 am
by zyklone
I just want to ask..how can i convert this link:

http://www.test.com/index.php?mod=abc&task=def

into

http://www.test.com/index/abc/def


please help..thanks :P

Posted: Fri Jun 22, 2007 10:36 am
by Gente
Have you tried to search the answer in the forum before?
I saw this question some days ago.

Posted: Fri Jun 22, 2007 11:47 am
by gnetcon
A good way I've found is to use Apache's mod_rewrite. This enables you to convert the /xxx/xxx/xxx to ?1=xxx&2=xxx&3=xxx. I don't remember the URL's off the top of my head, but you can easily Google it to find some.

Posted: Fri Jun 22, 2007 1:50 pm
by mentor
You need to use Apache's mod_rewrite to achieve this. After enabling mod_rewrite on apache, make a .htaccess file and use this rule

RewriteEngine on
RewriteRule ^index/(.*)/(.*)$ index.php?mod=$1&task=$2 [L]

Posted: Fri Jun 22, 2007 2:43 pm
by .Stealth
mentor wrote:You need to use Apache's mod_rewrite to achieve this. After enabling mod_rewrite on apache, make a .htaccess file and use this rule

RewriteEngine on
RewriteRule ^index/(.*)/(.*)$ index.php?mod=$1&task=$2 [L]

is there a way to do that dynamically for each file on your server?

Posted: Fri Jun 22, 2007 2:49 pm
by mentor
is there a way to do that dynamically for each file on your server?
Do you mean some sort of software or script that write all these rules for an existing site?
I dont know really.

Posted: Fri Jun 22, 2007 2:53 pm
by .Stealth
mentor wrote:
is there a way to do that dynamically for each file on your server?
Do you mean some sort of software or script that write all these rules for an existing site?
I dont know really.
it just seems alot to add this to every directory with every variable you expect.

by the way i tried that on my server and it didnt work for some reason and i have the rewrite thing on my site i checked it.

ahh well, im happy with the url variables, i tried learning this the other day and my head nearly blew up :lol:

Posted: Fri Jun 22, 2007 3:16 pm
by superdezign
Try to find some common ground. You shouldn't need to use it on everything.