Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As Vinko said, </p> <pre><code>RewriteLog "/tmp/rewrite.log" RewriteLogLevel 9 </code></pre> <p>and look at that file.</p> <p>Otherwise, here's the code we're using to redirect from zirconium.zrs.hr/~zatemas to zatemas.zrs.hr:</p> <pre><code>RewriteEngine on # For sites running on a port other than 80 RewriteCond %{HTTP_HOST} !^zatemas\.zrs\.hr [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^80$ RewriteRule ^/~zatemas/(.*) http://zatemas.zrs.hr:%{SERVER_PORT}/$1 [L,R] # And for a site running on port 80 RewriteCond %{HTTP_HOST} !^192\.168\.1\.24 [NC] RewriteCond %{HTTP_HOST} !^zatemas\.zrs\.hr [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/~zatemas/(.*) http://zatemas.zrs.hr/$1 [L,R] </code></pre> <p>I've seen around the web that people detect HTTPS primarily by looking if the port is 443. <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" rel="nofollow noreferrer">mod_rewrite documentation</a> says there should be a variable HTTPS set to on or off, appropriately - I presume you do <code>RewriteCond %{HTTPS} ^on$</code> to test if it's on.</p> <p>Also watch out: <code>.htaccess</code> directives for URL rewriting do not work nicely if you're accessing files in user's home directory - for example example.com/~username/. That should not bother you according to your scenario, though. My code above is placed in main server config, under the <code>VirtualHost</code> section(more precisely, in <code>/etc/apache2/sites-enabled/000-default</code>, but that's debian specific and gets merged in main config).</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