<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jessica Zhang on Medium]]></title>
        <description><![CDATA[Stories by Jessica Zhang on Medium]]></description>
        <link>https://medium.com/@codedbyjessica?source=rss-469679bab473------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*z33NA1S9mESVhumz.jpg</url>
            <title>Stories by Jessica Zhang on Medium</title>
            <link>https://medium.com/@codedbyjessica?source=rss-469679bab473------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:37:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@codedbyjessica/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dev’s TL;DR — Cache control with .htaccess]]></title>
            <link>https://medium.com/@codedbyjessica/devs-tl-dr-cache-control-with-htaccess-62e3c334a34f?source=rss-469679bab473------2</link>
            <guid isPermaLink="false">https://medium.com/p/62e3c334a34f</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jessica Zhang]]></dc:creator>
            <pubDate>Mon, 20 Feb 2017 19:43:09 GMT</pubDate>
            <atom:updated>2017-02-20T19:43:09.661Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Browser Caching</strong></h3><p>When a browser loads a webpage, it <strong>downloads </strong>all the files necessary for the webpage to display onto the users computer. This allows frequent visitors to experience <strong>faster loading times </strong>and allows the server to run faster. In general, caching is great.</p><h3><strong>Here is a situation where you may want to avoid caching:</strong></h3><p>When you are frequently updating your own website on your server and wishes to see the most updated version of your website online. You will have to either clear your cache repeatedly, or wait until the cache expires. You can make the cache expire faster through .htaccess. Using the following code, add it to your .htaccess file. This will set your cache to expire quickly so when you upload a new file onto your server, the changes can be seen immediately.</p><pre>&lt;IfModule mod_expires.c&gt;<br>   ExpiresActive On<br>   ExpiresDefault “access plus 2 minutes”<br>&lt;/IfModule&gt;</pre><p>For a brief overview of .htaccess, visit my previous blog post <a href="https://medium.com/@codedbyjessica/devs-tl-dr-intro-to-htaccess-and-custom-error-pages-936be6d06e22#.o9gmy14dd">here</a>.</p><p>And here is an example of other parameters that can be changed to specify the caching process.</p><pre>&lt;IfModule mod_expires.c&gt;<br>  ExpiresActive On<br>  ExpiresByType image/jpg &quot;access plus 1 year&quot;<br>  ExpiresByType image/gif &quot;access plus 1 year&quot;<br>  ExpiresByType image/png &quot;access plus 1 year&quot;<br>  ExpiresByType text/css &quot;access plus 1 month&quot;<br>  ExpiresByType application/pdf &quot;access plus 1 month&quot;<br>  ExpiresByType text/x-javascript &quot;access plus 1 month&quot;<br>  ExpiresByType image/x-icon &quot;access plus 1 year&quot;<br>  ExpiresDefault &quot;access plus 2 days&quot;<br>&lt;/IfModule&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62e3c334a34f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dev’s TL;DR — Intro to .htaccess and custom error pages]]></title>
            <link>https://medium.com/@codedbyjessica/devs-tl-dr-intro-to-htaccess-and-custom-error-pages-936be6d06e22?source=rss-469679bab473------2</link>
            <guid isPermaLink="false">https://medium.com/p/936be6d06e22</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[Jessica Zhang]]></dc:creator>
            <pubDate>Sun, 05 Feb 2017 19:54:53 GMT</pubDate>
            <atom:updated>2017-02-05T20:13:45.157Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is a brief introduction to using Apache’s .htaccess files</p><blockquote>A web server is a computer system that processes requests via <strong>HTTP</strong>, the basic network protocol used to distribute information on the World Wide Web.</blockquote><blockquote>— wikipedia</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*clLLolJep9RFCAPODyGHhA.png" /></figure><h3><strong>HTTP (hypertext transfer protocol) servers</strong></h3><p>Web pages are hosted by HTTP servers which means that they <strong>send and receive data using HTTP</strong>.</p><h3><strong>Apache</strong></h3><p><strong>Apache HTTP server</strong>, also called Apache, is the world’s most used web server <strong>software</strong>. Apache uses configuration files called <strong>.htaccess</strong> files (hypertext access files) to configure <strong>site access tasks</strong>.</p><h3><strong>Server configurations</strong></h3><p>Every Apache server has a master server configuration file which specifies the defaults.</p><p>Apache allows you to make folder specific <strong>.htaccess</strong> files to <strong>override </strong>the master defaults which allows you to <strong>customize </strong>tasks including; error handling, redirects and authentications.</p><p><strong><em>Note</em></strong><em>: using .htaccess files to heavily customize your tasks will slow down the server because it means that the server has to constantly open and read your customizations!</em></p><h3><strong>.htaccess</strong></h3><p>.htaccess files take commands called <strong>directives</strong>, which allows you to specify certain behaviours. You can only have one .htaccess file per folder and each file will affect the <strong>entire </strong>folder and it’s sub directories. (Typically, your main .htaccess file is stored in your public_html folder)</p><p>Your sub directories can have their own .htaccess file, but it will lag the server if it gets complicated!</p><p><strong>Example</strong>: if you wish to call your landing page landingpage.html instead of index.html, this is how you would write it in your .htaccess file:</p><pre>DirectoryIndex landingpage.html</pre><p>So when you go type in <strong>www.mydomain.com</strong> in your browser, instead of directing to www.mydomain.com/<strong>index.html</strong> the .htaccess file will direct the user to www.mydomain.com/<strong>landingpage.html.</strong></p><h3>HTTP status codes</h3><p>Some examples of status code types and status codes:</p><p><strong>Success 2xx</strong>: indicates success. Example: <strong>202 </strong>— accepted</p><p><strong>Redirect 3xx</strong>: indicates action to be taken (usually automatically) by the client in order to fulfill the request. Example: <strong>301</strong> — moved</p><p><strong>Error 4xx</strong>: indicates that there is an error on the client side. Example: <strong>401</strong> — unauthorized, <strong>404 </strong>— file not found</p><p><strong>Error 5xx</strong>: indicates that the server is aware that there is an error on the server side. Example: <strong>503</strong> — Gateway timeout</p><p><strong>Example</strong>: So if you wanted to customize the 404 page on your website, you can add this code into your .htaccess file:</p><pre>ErrorDocument 404 /CustomErrorPages/404.html</pre><p>The <strong>ErrorDocument</strong> directive tells Apache how to handle certain error codes. The directive takes 2 parameters, <strong>an error code</strong> and a <strong>response</strong> (a message or a file). In this case, the error code is <strong><em>404</em></strong> and the response is<em> “show the client </em><strong><em>/CustomErrorPages/404.html</em></strong><em> when the page they are looking for is not found”</em>. When specifying a file, the path must start with / to work. Note, don’t actually use uppercase in your folder names…</p><p>I hope this post explained the basics of .htaccess files and how to use them.</p><p>Check out Error 418 and make sure to click on it! <a href="https://www.google.com/teapot">https://www.google.com/teapot</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=936be6d06e22" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>