search-friendly url

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
zyklone
Forum Commoner
Posts: 29
Joined: Tue Nov 28, 2006 10:25 pm

search-friendly url

Post 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
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Have you tried to search the answer in the forum before?
I saw this question some days ago.
gnetcon
Forum Newbie
Posts: 4
Joined: Fri Jun 22, 2007 11:24 am

Post 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.
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Post 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]
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

Post 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?
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Post 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.
.Stealth
Forum Commoner
Posts: 57
Joined: Wed Jan 10, 2007 12:15 pm
Location: Manchester, England

Post 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:
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Try to find some common ground. You shouldn't need to use it on everything.
Post Reply