title: Using friendly URLs to avoid cache problem
body: <p>In my application (*) I sometimes needs to open (in the default user browser) a URL with some parameters.</p>
  
  <ul>
  <li>e.g.: <a href="http://www.mySite.com/myPage.php?p1=param1&amp;p2=param2&amp;p3=param3" rel="nofollow">http://www.mySite.com/myPage.php?p1=param1&amp;p2=param2&amp;p3=param3</a></li>
  </ul>
  
  <p>On some computers, I had cache problem, even if I send different parameters, the browser opened the page with the old parameters.</p>
  
  <p>I tried to add time-stamp as the first parameter:</p>
  
  <ul>
  <li>e.g.: <a href="http://www.mySite.com/myPage.php?pXXX=XXX&amp;p1=param1&amp;p2=param2&amp;p3=param3" rel="nofollow">http://www.mySite.com/myPage.php?pXXX=XXX&amp;p1=param1&amp;p2=param2&amp;p3=param3</a></li>
  <li>where XXX = Now.ToString("ssmmHHddMMyy")</li>
  </ul>
  
  <p>but still, on some computers it did not solve the problem.</p>
  
  <p>I wonder if using friendly URLs will help avoiding the cache problem for all users, all browsers, all default settings etc. </p>
  
  <ul>
  <li>e.g.: <a href="http://www.mySite.com/myFalsePage/param1/param2/param3" rel="nofollow">http://www.mySite.com/myFalsePage/param1/param2/param3</a></li>
  </ul>
  
  <p>[  My source for using friendly URLs:</p>
  
  <ul>
  <li><a href="http://techie-buzz.com/how-to/create-seo-friendly-urls-using-mod-rewrite-and-php-part-1.html" rel="nofollow">http://techie-buzz.com/how-to/create-seo-friendly-urls-using-mod-rewrite-and-php-part-1.html</a></li>
  <li><a href="http://techie-buzz.com/tips-and-tricks/create-seo-friendly-urls-with-mod-rewrite-and-php-part-ii.html" rel="nofollow">http://techie-buzz.com/tips-and-tricks/create-seo-friendly-urls-with-mod-rewrite-and-php-part-ii.html</a></li>
  </ul>
  
  <p>]</p>
  
  <p><strong>Are you aware of any dis-advantages in using this method of passing parameters?</strong></p>
  
  <p>Thanks,</p>
  
  <p>Atara.</p>
  
  <p>(*) My application is an exe file (VB .Net)
  One of the menu options of the application is opening the URL, using the user default browser:</p>
  
  <pre><code> '-- Create temporary *.url file and open it
    Try
      Dim line1 As String = "[InternetShortcut]"
      Dim line2 As String = "URL=" &amp; sUrl
      Dim dst As String = GetSystemPathTemp() &amp; "myAppTemp.url"
  
      Dim sw As New System.IO.StreamWriter(dst, False)
      sw.WriteLine(line1)
      sw.WriteLine(line2)
      sw.Close()
  
      System.Diagnostics.Process.Start(Chr(34) &amp; dst &amp; Chr(34))   
  </code></pre>
  
  <p>The URL is a form, the parameters are some of the fields of the form, so that the user wont have to type them. </p>
  
  <p>Usually the user fills-in the form and re-directed to a "Thank you" page. </p>
  
  <p>My problem: The next time the user clicks the menu, and opens the URL\form, there should be different field values in the form, according to the current application stage, BUT on some computers\users\browsers the first URL is cached, and after that, all forms are filled with the initial fields, so the user needs to manually edit them (If he noticed the problem), otherwise I get the form results with non-accurate information - the new user notes with the previous-wrong field-values. </p>
  
  <p>My form page now starts with -</p>
  
  <pre><code>&lt;?php
  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");   // Date in the past
  </code></pre>
  
  <p>Until today, it started with all the following options -</p>
  
  <pre><code>&lt;?php
  //disable all browser caching MUST BE FIRST LINES WITH NO PRECEEDING SPACES ETC
  // Date in the past
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  
  // always modified
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  
  // HTTP/1.1
  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
  
  // HTTP/1.0
  header("Pragma: no-cache");
  </code></pre>
  
  <p>The file "myAppTemp.url" is updated, but the browser opens the older link. </p>