Results 1 to 5 of 5

Thread: How to get rid of PHPSESSID in URL?

  1. #1
    Join Date
    Aug 2008
    Posts
    3

    Question How to get rid of PHPSESSID in URL?

    Hello,

    I am at my wits end with this problem. When a form is successfully submitted and the page redirected to another URL, there is always a PHPSESSID string attached to the end of the redirected URL. I have tried several tips to prevent this, including this, but all to no avail. I am therefore led to believe there must be something in the FormMail code that does this.

    Anyone know how I can disable this from happening?

    Thank you,
    Paul

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Question Re: How to get rid of PHPSESSID in URL?

    Hi,

    FormMail goes to a lot of trouble to ensure the PHP session ID is included in the URL.

    The main reason is for dealing with dynamic templates and during error handling.

    But, the redirect to good_url is also included in this processing so that those people who want to access information from the session in that final page can do so.

    In most cases you won't see the session ID in the URL because it is stored in a cookie in the user's browser. So, you probably have cookies switched off in your browser.

    Why does this issue matter to you?
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Feb 2007
    Posts
    162

    Default Re: How to get rid of PHPSESSID in URL?

    Quote Originally Posted by Paul123 View Post
    Hello,

    I am at my wits end with this problem. When a form is successfully submitted and the page redirected to another URL, there is always a PHPSESSID string attached to the end of the redirected URL. I have tried several tips to prevent this, including this, but all to no avail. I am therefore led to believe there must be something in the FormMail code that does this.

    Anyone know how I can disable this from happening?

    Thank you,
    Paul
    Getting rid of the URL is actually quite easy, you just have use some simple Apache mod_rewriting. Look up a tutorial on mod_rewrite, and then consider this rewrite rule:

    RewriteRule ^good_url.php(.*)$ http://www.yourdomain.com/good_url.php? [R=301]

    This creates a redirect for any request to good_url.php that has a query string, and simply redirects to the same page minus the query string.

  4. #4
    Join Date
    Feb 2007
    Posts
    162

    Default Re: How to get rid of PHPSESSID in URL?

    I felt the need to elaborate on rewriting the URL to eliminate query strings. While I did provide a working URL, I didn't share the rewrite condition that must be satisfied, and without doing so, the server would infinite loop the request to the non-query-stringed URL.

    So, say you had nothing else in your root .htaccess file, and you want to rewrite any request to good_url.php with a query string to the non query string equivalent. This is what you would do:

    Code:
    Options FollowSymLinks
    RewriteEngine on
    RewriteCond %{THE_REQUEST} ^GET\ /good_url\.php.*\ HTTP/ [NC]
    RewriteCond %{QUERY_STRING} !^$ 
    RewriteRule ^good_url.php(.*)$ http://www.yourdomain.com/good_url.php? [R=301]

  5. #5
    Join Date
    Jan 2012
    Posts
    3

    Default Re: How to get rid of PHPSESSID in URL?

    I found it easy to just make a dummy page with a redirect link in the header and store this in a folder named 'templates'.
    You of course have to configure formmail.php around line 338:

    /* Help: http://www.tectite.com/fmdoc/templatedir.php */
    $TEMPLATEDIR = "http://www.yourdomain.uk.com/templates"; // directory for template files; empty string
    // if you don't have any templates

    Then edit good_template line in your form:
    <input type="hidden" name="good_template" value="path/to/success_dummypage.htm" />

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Advance Error -no returne URL
    By JohnB in forum FormMail Subscription Support
    Replies: 7
    Last Post: 01-Jan-2005, 10:15 PM
  2. Using formmail from URL bar?
    By Eric Sandres in forum FormMail Subscription Support
    Replies: 1
    Last Post: 05-Nov-2004, 02:52 AM
  3. Now I am stomped! URL for redirect
    By sigurdur in forum FormMail Subscription Support
    Replies: 3
    Last Post: 01-Aug-2004, 12:02 AM
  4. Formmail File Visible In URL Address
    By amazing616 in forum FormMail Subscription Support
    Replies: 5
    Last Post: 03-Jun-2004, 08:13 PM
  5. The requested URL was not found on this server.
    By aussieincanada in forum FormMail Subscription Support
    Replies: 1
    Last Post: 27-May-2004, 07:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •