<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Nginx on Janusworx</title>
    <link>https://janusworx.com/tags/nginx/</link>
    <description>Recent content in Nginx on Janusworx</description>
    <image>
      <title>Janusworx</title>
      <url>https://janusworx.com/images/jw-logo.png</url>
      <link>https://janusworx.com/images/jw-logo.png</link>
    </image>
    <generator>Hugo -- 0.162.1</generator>
    <language>en</language>
    <lastBuildDate>Mon, 22 Jul 2019 13:40:35 +0530</lastBuildDate>
    <atom:link href="https://janusworx.com/tags/nginx/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>NGINX Redirect .html to just slugs</title>
      <link>https://janusworx.com/work/nginx-redirect-html-to-just-slugs/</link>
      <pubDate>Mon, 22 Jul 2019 13:40:35 +0530</pubDate>
      <guid>https://janusworx.com/work/nginx-redirect-html-to-just-slugs/</guid>
      <description>&lt;p&gt;I like Nikola’s pretty URLs feature and have been using it at the &lt;a href=&#34;https://mjbraganza.com&#34;&gt;personal site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;And after a year of prettiness there and .html here, I decided to switch this site to use it too.&lt;br&gt;
All my urls look nice now :)&lt;br&gt;
Which also means all the old links are now broken.&lt;br&gt;
And so, the last bit of work was to redirect all the links in the wild and on the blog to the new addresses&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I like Nikola’s pretty URLs feature and have been using it at the <a href="https://mjbraganza.com">personal site</a>.</p>
<p>And after a year of prettiness there and .html here, I decided to switch this site to use it too.<br>
All my urls look nice now :)<br>
Which also means all the old links are now broken.<br>
And so, the last bit of work was to redirect all the links in the wild and on the blog to the new addresses</p>
<p>A quick web search led me to this <a href="https://stackoverflow.com/questions/24225145/nginx-remove-php-and-html-file-extension/32966347#32966347">stackoverflow answer</a>.</p>
<pre tabindex="0"><code>#at the top of location /
if ($request_uri ~ ^/(.*)\.html$) {  return 302 /$1;  }

#within \.php$
if ($request_uri ~ ^/([^?]*)\.php($|\?)) {  return 302 /$1?$args;  }
</code></pre></br>
<p><s>All I needed was the top bit and all was well, with my world :)</s></p>
<p>Update: Gave up on the redirect idea, beacause it was breaking pagination on the blog.  Well, I tried :)</p>
<hr>
]]></content:encoded>
    </item>
  </channel>
</rss>
