Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your last example should work; I'd also check the condition to be case-insensitive (to avoid /LoCation/indeX.htmL from being parsed), terminate rewrite with [L] (to prevent infinite loops) and add QSA (for appending queries):</p> <pre><code>RewriteEngine on RewriteCond %{REQUEST_URI} !location/index.html [NC] RewriteRule ^location/(.*)$ /location/index.html?location=$1 [L,QSA] </code></pre> <p>How do you read out (and echo) the location GET variable? "I'm using JavaScript to echo out an alert that prints the "location" variable."</p> <p>JavaScript runs inside your browser ("client-side"), therefore it works with the same data that your browser sees. I.e., if you point your browser at <code>http://www.example.com/foo/bar/</code> , then no matter what rewriting you use at the server, Javascript will still see "<code>http://www.example.com/foo/bar/</code>" as the location.</p> <p>To access the GET variables, you need some code to access them when the page is generated ("server-side"), before it is sent to the browser. For example, when you have a PHP-capable server, the following script at <a href="http://www.example.com/location/index.php" rel="nofollow noreferrer">http://www.example.com/location/index.php</a> and you redirect to it through something like the above code, it will be able to access and work with the GET variables:</p> <pre><code>&lt;?php echo 'The location you entered is ' . $_GET['location'] . '.'; ?&gt; </code></pre> <p>When combined with the rewrite, for URL <code>http://www.example.com/location/Houston,TX</code> it will print out this:</p> <pre><code>The location you entered is Austin,TX. </code></pre> <p>(of course, there are many server-side languages, I'm using PHP as an example I'm most familiar with)</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. 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