WordPress.org

Ready to get started?Download WordPress

Forums

passing vars through templates appends URL (2 posts)

  1. jtpratt
    Member
    Posted 6 years ago #

    I have a situation where I'm getting some data external to my wordpress blog by using javascript code, and I've created 10 wordpress theme template files. Each file is assigned to a wordpress "page" that I've setup.

    The main one is the home, this is where users start. Let's say this site is about travel:
    /book-travel

    the user is presented with some choices on the page, and when they click those vars are passed to a new page in the URL like this

    /book-travel/book-hotel/?city=Detroit

    notice how wordpress automatically adds a trailing forward slash '/' in between the child-page and the action vars being passed. This is what I need to figure out how to get get rid of so all the pages will work properly.

    what I did was, in WordPress I created the main page "book-travel", and then I have 9 child pages. Each one uses a theme template page that contains the javascript code to intercept the action from the previous page and display the results.

    the pages work just fine when clicked from the /booktravel home no problem - despite the trailing forward slash. Like these examples:

    /book-travel/book-flight/?city=Bermuda
    /book-travel/book-car/?city=LA

    The problem I'm having is when a user clicks an option from a child page the URL gets appended with a new child directory (because of the slash) and the URL comes up as a 404 not found.

    In other words, if a user clicks an option from a child page like this:

    /book-travel/book-flight/?city=Detroit

    the resultant URL comes up like this:

    /book-travel/book-flight/book-city?city=Detroit&location=gate5

    the URL should have been:

    /book-travel/book-city?city=Detroit&location=gate5

    I don't have control of any of the javascript code in these pages or the results that come back from the company server. I do think that if I can get the trailing forward slash out of the URL all will be well.

    Any ideas? I'm assuming WordPress automatically adds that to pages? Is there any way to stop if from occurring?

  2. jtpratt
    Member
    Posted 6 years ago #

    not a single reply in 3 days - nobody has even a single suggestion?

Topic Closed

This topic has been closed to new replies.

About this Topic