Help needed with changing url structure of dynamic pages

GVSET001

Regular Member
Joined
Sep 26, 2012
Messages
417
Reaction score
127
currently my url is something like this..

example.com/index.php?item1=BLUE%20BOX&item2=WHITEBOX&item3=ORANGE%20BOX&ITEM4=REDBOX
what i want to make it like ..

example.com/index.php/BLUE-BOX/WHITEBOX/ORANGE-BOX/REDBOX

javascript i am using is..
Code:
function reload(form)
{
var val=form.item1.options[form.item1.options.selectedIndex].value;
self.location='index.php?item1=' + val ;

}
function reload3(form)
{
var val=form.item1.options[form.item1.options.selectedIndex].value;
var val2=form.item2.options[form.item2.options.selectedIndex].value;

self.location='index.php?item1=' + val + '&item2=' + val2 ;
}
function reload4(form)
{

var val=form.item1.options[form.item1.options.selectedIndex].value;
var val2=form.item2.options[form.item2.options.selectedIndex].value;
var val3=form.item3.options[form.item3.options.selectedIndex].value;

self.location='index.php?item1=' + val + '&item2=' + val2 + '&item3=' + val3 ;
}

function reload5(form)
{

var val=form.item1.options[form.item1.options.selectedIndex].value;
var val2=form.item2.options[form.item2.options.selectedIndex].value;
var val3=form.item3.options[form.item3.options.selectedIndex].value;
var val4=form.item4.options[form.item4.options.selectedIndex].value;
self.location='index.php?item1=' + val + '&item2=' + val2 + '&item3=' + val3 + '&item4=' + val4 ;
}
in php i am using dynamic chain dropdown list the dropdown data is being populated from the database.i am using 4 dropdown box each of them is dependend on another.on every dropdown item select i am using -onchange=\"reload(this.form)

is there any way to achieve this through javascript..as the self.location is responsible for changing the url i guess..

i also tried with mod_rewrite but its not working in localhost..

any solution for this would be highly appreciated.. please help asap
 
mod_rewrite doesn't usually work on localhost for some stacks (xampp/wamp) because it doesn't load the .htaccess file(s).

Check to make sure the .htaccess file is loading by just doing a redirect from the root directory to another one. If it fails you'll need to get it loading, and if it works you need to check your regular expression.
 
Back
Top