Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect references to root to current alias instead
    primarykey
    data
    text
    <p>I'm using a local install of Apache 2.2.11 and have set up an alias to a folder above the document root (<code>alias localhost/fp/ =&gt; /www/dirs/friendpages</code>). I would like to be able to redirect requests to "/favicon.ico" to <code>localhost/fp/favicon.ico</code> as opposed to <code>localhost/favicon.ico</code> with a .htaccess file in <code>localhost/fp</code>. Is this possible and if so, how would I do that?</p> <p>The reference to favicon.ico, would come from a file such as the following: <code>/www/dirs/friendpages/test.htm (localhost/fp/test.htm)</code> =></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"&gt; &lt;/head&gt; &lt;body&gt; Page using favicon.ico &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I have made several attempts using RewriteRule. For example,</p> <pre><code>RewriteRule ^/favicon.ico$ /www/dirs/friendpages/favicon.ico </code></pre> <p>...but have not been able to find a solution. It appears that I'm confused about what exactly <em>Pattern</em> is and what <em>Substitution</em> should be (given <code>RewriteRule Pattern Substitution</code>). I'm especially confused about how I would set up a RewriteRule distinguishing a relative file reference such as the one via the link tag above vs. an absolute one like "localhost/fp/favicon.ico" (the latter obviously not requiring a redirection).</p> <p>I also enabled rewrite logging using the following in my <code>httpd.conf</code> file:</p> <pre><code>RewriteLogLevel 9 RewriteLog /logs/rewrite.log </code></pre> <p>...but all I get, when loading the above listed <code>localhost/fp/test.htm</code> with the above stated RewriteRule is this:</p> <pre><code>127.0.0.1 - - [04/Nov/2011:05:09:51 --0700] [localhost/sid#14f44f8][rid#2619268/initial] (3) [perdir /www/dirs/friendpages/] strip per-dir prefix: /www/dirs/friendpages/test.htm -&gt; test.htm 127.0.0.1 - - [04/Nov/2011:05:09:51 --0700] [localhost/sid#14f44f8][rid#2619268/initial] (3) [perdir /www/dirs/friendpages/] applying pattern '^/favicon.ico$' to uri 'test.htm' 127.0.0.1 - - [04/Nov/2011:05:09:51 --0700] [localhost/sid#14f44f8][rid#2619268/initial] (1) [perdir /www/dirs/friendpages/] pass through /www/dirs/friendpages/test.htm </code></pre> <p>I have discovered that an alternative way (short of hardcoding the appropriate reference itself) to achieve the desired result is to set up a virtual host (as opposed to simply using an alias) but my gut-feeling is that this should also be possible using mod_rewrite and .htaccess... just how?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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