Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For Issue 1: a simple rewrite can handle that, you need to use the [QSA] flag. Something like this:</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^.*\.(jpeg|jpg|gif|png|bmp)$ RewriteRule ^(.+)$ /getphoto.php?photo=$1 [L,QSA] </code></pre> <p>This will rewrite behind the scenes the url <a href="http://mywebsite.com/12_3.jpg" rel="nofollow">http://mywebsite.com/12_3.jpg</a> to <a href="http://mywebsite.com/getphoto.php?photo=12_3.jpg" rel="nofollow">http://mywebsite.com/getphoto.php?photo=12_3.jpg</a> Note that the 3rd rewrite condition wants the URI to end with an image extension, you may not need it.</p> <p>For Issue 2, it depends on how something like "4" maps to "zuck". If you are going to hardcode them into your apache config, you can use a RewriteCond:</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_URI} ^/4$ RewriteRule ^.*$ /zuck [L] RewriteCond %{REQUEST_URI} ^/5$ RewriteRule ^.*$ /mark [L] </code></pre> <p>etc. (or replace <code>[L]</code> with <code>[R,L]</code> to redirect instead of rewrite, or alternatively just use <code>Redirect</code>)</p> <pre><code>Redirect /4 /zuck Redirect /5 /mark </code></pre> <p>etc.</p> <p>If the mapping is stored in a database, your going to need to do this dynamically, perhaps as a php script to do a redirect, utilizing something similar to Issue 1. The rewrite rule would rewrite to something like <code>/redirect.php?id=$1</code> and your redirect.php script would take the <code>id</code> and do a database lookup to see where to redirect the browser.</p>
 

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