Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing .htaccess to serve static files via a subdomain
    text
    copied!<p>Right, excuse my stupidity, I've looked through a load of examples on t'interweb but I don't think I've found what I'm looking for.</p> <p>I have a website, <code>photography.example.com</code> is the main site but I also want to have another subdomain to serve static files, for example <code>static.photography.example.com</code>.</p> <p>If I request a file (e.g. <code>http://static.photography.example.com/js/jquery.js</code>) I want that file to be retrieved from the non-static domain, allowing me to keep my file structure completely untouched but using multiple domains to allow more concurrent http requests.</p> <p>I don't want to throw any http responses that would make the browser thing the file has been moved, I just want to mirror the files from the normal domain to the static domain. After this I would proceed to set far future expired to improve caching etc.</p> <p>How do I achieve this using <code>.htaccess</code>?</p> <p><strong>EDIT 1</strong></p> <p>So after a bit of messing around I have come up with this:</p> <pre><code>Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)$ http://photography.example.com/$1 [L] </code></pre> <p>But this actually redirects to the domain I'm trying to read, I want it to serve the file up under the static domain name, any help with modifying this script would be greatly appreciated.</p> <p><strong>EDIT 2</strong></p> <p>So I've amended my DNS and waited a few days for it to propagate but the CNAME technique doesn't work either. Here's the entry:</p> <p><img src="https://i.stack.imgur.com/9ny25.png" alt="alt text"></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