Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If your mod_rewrite has a rule like the following:</p> <pre><code>RewriteRule ^hello/world /?action=hello&amp;sub=world [NC,L] </code></pre> <p>or, the more generalised:</p> <pre><code>// Assuming only lowercase letters in action &amp; sub.. RewriteRule ^([a-z]+)/([a-z]+) /?action=$1&amp;sub=$2 [NC,L] </code></pre> <p>then the same PHP script is being called, with the <code>$_REQUEST</code> variables available whichever way the user accesses the page (dirty or clean url). </p> <p>We recently moved a large part of our site to clean urls (still supporting the older, "dirty" urls) and rules like the above meant we didn't have to rewrite any code that relied on <code>$_REQUEST</code> params, only the mod_rewrite rules.</p> <p><strong>Update</strong></p> <p>Mod_rewrite is an Apache module, but there are a number of options <a href="http://en.wikipedia.org/wiki/Rewrite_engine#IIS" rel="nofollow noreferrer">available for IIS</a> also. </p> <p>Whichever web server you decide to support, the mod_rewrite approach will likely result in the least amount of work for you. Without it, you'd likely have to create a load of files to mimic the structure of your clean urls, e.g. in your webserver root you'd create a directory <code>hello</code>, placing a file <code>world</code> into it, containing something like the following:</p> <pre><code>// Set the $_REQUEST params to mimic dirty url $_REQUEST['action'] = 'hello'; $_REQUEST['sub'] = 'world'; // Include existing file so we don't need to re-do our logic // (assuming index.php at web root) include('../index.php'); </code></pre> <p>As the number of parameters you wish to handle 'cleanly' increases, so will the number of directories and stub files you require, which will greatly increase your maintenance burden.</p> <p>mod_rewrite is designed for exactly this sort of problem, and is now supported on IIS as well as Apache, so I'd strongly recommend going in that direction!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload