.htaccess with Array parameters (checkbox) and three others. GET method









up vote
0
down vote

favorite












I have been tried to get this to work for a while now.



I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



I have successfully did it this one of my pages here:



RewriteCond %REQUEST_FILENAME -s [OR]
RewriteCond %REQUEST_FILENAME -l [OR]
RewriteCond %REQUEST_FILENAME -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



<script>
$(document).on('change', 'select', function()
var itemSpecifics = document.getElementById('itemSpecifics');
var submitButton = document.getElementById('submitButton');
var narrowHelper = document.getElementById('narrowHelper');
narrowHelper.innerHTML = "select all of the filters you want to search by.";
var loading = document.getElementById('loading');
loading = loading.style.display = "block";
document.getElementById("submitButton").style.display = "none";
//$("#submitButton").empty();
$("#itemSpecifics").empty();
$.ajax(
type : 'GET',
url : 'refine_search.php',
data: category: $(this).val(),
cache: false,
dataType : 'json',
encode : true,
traditional: true,
success: function (response, status, xhr)
console.log(response);

for (var i = 0; i < response.length; i++)
console.log(response[i].name);
itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
//console.log(response[i].value);
for (var j = 0; j < response[i].value.length; j++)
console.log("-- " + response[i].value[j].value);
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.name = "cb";
checkbox.value = response[i].name + "@" + response[i].value[j].value;
checkbox.id = "checkboxid";
var label = document.createElement('label')
label.htmlFor = "id";
label.id = "label";
label.appendChild(document.createTextNode(response[i].value[j].value));
itemSpecifics.appendChild(checkbox);
itemSpecifics.innerHTML += " ";
itemSpecifics.appendChild(label);
itemSpecifics.innerHTML += "<br>";
$("input[type='checkbox']").on('change', function()
console.log($(this).val());
);




submitButton.innerHTML = "SUBMIT";
document.getElementById("loading").style.display = "none";
document.getElementById("submitButton").style.display = "block";
,
error: function (xhr, status, error)
console.log(error);

);
// if you want to do stuff based on the OPTION element:
var opt = $(this).find('option:selected')[0];
// use switch or if/else etc.
);
</script>


This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



<form action="example.net/results" method="GET">


When this form is submitted, I get this...



https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


What I would LOVE to be able to do, is to route that above URL to...



https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


OR, removing the &cb%5B%5D=



Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.










share|improve this question



























    up vote
    0
    down vote

    favorite












    I have been tried to get this to work for a while now.



    I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



    I have successfully did it this one of my pages here:



    RewriteCond %REQUEST_FILENAME -s [OR]
    RewriteCond %REQUEST_FILENAME -l [OR]
    RewriteCond %REQUEST_FILENAME -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


    This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



    However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



    <script>
    $(document).on('change', 'select', function()
    var itemSpecifics = document.getElementById('itemSpecifics');
    var submitButton = document.getElementById('submitButton');
    var narrowHelper = document.getElementById('narrowHelper');
    narrowHelper.innerHTML = "select all of the filters you want to search by.";
    var loading = document.getElementById('loading');
    loading = loading.style.display = "block";
    document.getElementById("submitButton").style.display = "none";
    //$("#submitButton").empty();
    $("#itemSpecifics").empty();
    $.ajax(
    type : 'GET',
    url : 'refine_search.php',
    data: category: $(this).val(),
    cache: false,
    dataType : 'json',
    encode : true,
    traditional: true,
    success: function (response, status, xhr)
    console.log(response);

    for (var i = 0; i < response.length; i++)
    console.log(response[i].name);
    itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
    //console.log(response[i].value);
    for (var j = 0; j < response[i].value.length; j++)
    console.log("-- " + response[i].value[j].value);
    var checkbox = document.createElement('input');
    checkbox.type = "checkbox";
    checkbox.name = "cb";
    checkbox.value = response[i].name + "@" + response[i].value[j].value;
    checkbox.id = "checkboxid";
    var label = document.createElement('label')
    label.htmlFor = "id";
    label.id = "label";
    label.appendChild(document.createTextNode(response[i].value[j].value));
    itemSpecifics.appendChild(checkbox);
    itemSpecifics.innerHTML += " ";
    itemSpecifics.appendChild(label);
    itemSpecifics.innerHTML += "<br>";
    $("input[type='checkbox']").on('change', function()
    console.log($(this).val());
    );




    submitButton.innerHTML = "SUBMIT";
    document.getElementById("loading").style.display = "none";
    document.getElementById("submitButton").style.display = "block";
    ,
    error: function (xhr, status, error)
    console.log(error);

    );
    // if you want to do stuff based on the OPTION element:
    var opt = $(this).find('option:selected')[0];
    // use switch or if/else etc.
    );
    </script>


    This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



    <form action="example.net/results" method="GET">


    When this form is submitted, I get this...



    https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


    What I would LOVE to be able to do, is to route that above URL to...



    https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


    OR, removing the &cb%5B%5D=



    Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have been tried to get this to work for a while now.



      I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



      I have successfully did it this one of my pages here:



      RewriteCond %REQUEST_FILENAME -s [OR]
      RewriteCond %REQUEST_FILENAME -l [OR]
      RewriteCond %REQUEST_FILENAME -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


      This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



      However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



      <script>
      $(document).on('change', 'select', function()
      var itemSpecifics = document.getElementById('itemSpecifics');
      var submitButton = document.getElementById('submitButton');
      var narrowHelper = document.getElementById('narrowHelper');
      narrowHelper.innerHTML = "select all of the filters you want to search by.";
      var loading = document.getElementById('loading');
      loading = loading.style.display = "block";
      document.getElementById("submitButton").style.display = "none";
      //$("#submitButton").empty();
      $("#itemSpecifics").empty();
      $.ajax(
      type : 'GET',
      url : 'refine_search.php',
      data: category: $(this).val(),
      cache: false,
      dataType : 'json',
      encode : true,
      traditional: true,
      success: function (response, status, xhr)
      console.log(response);

      for (var i = 0; i < response.length; i++)
      console.log(response[i].name);
      itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
      //console.log(response[i].value);
      for (var j = 0; j < response[i].value.length; j++)
      console.log("-- " + response[i].value[j].value);
      var checkbox = document.createElement('input');
      checkbox.type = "checkbox";
      checkbox.name = "cb";
      checkbox.value = response[i].name + "@" + response[i].value[j].value;
      checkbox.id = "checkboxid";
      var label = document.createElement('label')
      label.htmlFor = "id";
      label.id = "label";
      label.appendChild(document.createTextNode(response[i].value[j].value));
      itemSpecifics.appendChild(checkbox);
      itemSpecifics.innerHTML += " ";
      itemSpecifics.appendChild(label);
      itemSpecifics.innerHTML += "<br>";
      $("input[type='checkbox']").on('change', function()
      console.log($(this).val());
      );




      submitButton.innerHTML = "SUBMIT";
      document.getElementById("loading").style.display = "none";
      document.getElementById("submitButton").style.display = "block";
      ,
      error: function (xhr, status, error)
      console.log(error);

      );
      // if you want to do stuff based on the OPTION element:
      var opt = $(this).find('option:selected')[0];
      // use switch or if/else etc.
      );
      </script>


      This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



      <form action="example.net/results" method="GET">


      When this form is submitted, I get this...



      https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


      What I would LOVE to be able to do, is to route that above URL to...



      https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


      OR, removing the &cb%5B%5D=



      Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.










      share|improve this question















      I have been tried to get this to work for a while now.



      I am doing a web app where I would like to to have the web URL be example.net/param/param/param/param etc.



      I have successfully did it this one of my pages here:



      RewriteCond %REQUEST_FILENAME -s [OR]
      RewriteCond %REQUEST_FILENAME -l [OR]
      RewriteCond %REQUEST_FILENAME -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^(.*)$ /i/index.php?id=$1 [NC,L]


      This takes example.com/i?id=1212112 and turns it into example.com/i/1212112.



      However, I have another directory, results, that gets a POST from domain.com (index). I have a form inside of results that gets information via AJAX call and builds out a form. That code is below.



      <script>
      $(document).on('change', 'select', function()
      var itemSpecifics = document.getElementById('itemSpecifics');
      var submitButton = document.getElementById('submitButton');
      var narrowHelper = document.getElementById('narrowHelper');
      narrowHelper.innerHTML = "select all of the filters you want to search by.";
      var loading = document.getElementById('loading');
      loading = loading.style.display = "block";
      document.getElementById("submitButton").style.display = "none";
      //$("#submitButton").empty();
      $("#itemSpecifics").empty();
      $.ajax(
      type : 'GET',
      url : 'refine_search.php',
      data: category: $(this).val(),
      cache: false,
      dataType : 'json',
      encode : true,
      traditional: true,
      success: function (response, status, xhr)
      console.log(response);

      for (var i = 0; i < response.length; i++)
      console.log(response[i].name);
      itemSpecifics.innerHTML += "<div style="color:#ec5b6e">" + response[i].name + "</div>";
      //console.log(response[i].value);
      for (var j = 0; j < response[i].value.length; j++)
      console.log("-- " + response[i].value[j].value);
      var checkbox = document.createElement('input');
      checkbox.type = "checkbox";
      checkbox.name = "cb";
      checkbox.value = response[i].name + "@" + response[i].value[j].value;
      checkbox.id = "checkboxid";
      var label = document.createElement('label')
      label.htmlFor = "id";
      label.id = "label";
      label.appendChild(document.createTextNode(response[i].value[j].value));
      itemSpecifics.appendChild(checkbox);
      itemSpecifics.innerHTML += " ";
      itemSpecifics.appendChild(label);
      itemSpecifics.innerHTML += "<br>";
      $("input[type='checkbox']").on('change', function()
      console.log($(this).val());
      );




      submitButton.innerHTML = "SUBMIT";
      document.getElementById("loading").style.display = "none";
      document.getElementById("submitButton").style.display = "block";
      ,
      error: function (xhr, status, error)
      console.log(error);

      );
      // if you want to do stuff based on the OPTION element:
      var opt = $(this).find('option:selected')[0];
      // use switch or if/else etc.
      );
      </script>


      This spits out A LOT of checkboxes and labels. When they are selected, I grab the value and save it in the cb array for the name of the checkbox. For form has this.



      <form action="example.net/results" method="GET">


      When this form is submitted, I get this...



      https://www.example.com/results/?cb%5B%5D=Model%40Xbox+360+Arcade&cb%5B%5D=Model%40Xbox+360+Core&cb%5B%5D=Model%40Xbox+360+E&cb%5B%5D=Model%40Xbox+360+Elite


      What I would LOVE to be able to do, is to route that above URL to...



      https://www.example.com/results/Model%40Xbox+360+Arcade/Model%40Xbox+360+Core/Model%40Xbox+360+E/Model%40Xbox+360+Elite


      OR, removing the &cb%5B%5D=



      Can anyone help me with that? I tried doing a POST method for the form, but when I do that, the code only grabs the last cb= and then only the first character of the string.







      php ajax .htaccess






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 12:19









      lgwilliams

      159212




      159212










      asked Nov 10 at 12:13









      DroiDev

      1,4181315




      1,4181315



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238831%2fhtaccess-with-array-parameters-checkbox-and-three-others-get-method%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238831%2fhtaccess-with-array-parameters-checkbox-and-three-others-get-method%23new-answer', 'question_page');

          );

          Post as a guest














































































          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto