title: Match subdirectory with Javascript
body: <p>I m trying to match subdirectory and populate the variable according to it. This is what I have done so far.</p>
  
  <p>For example i have a domain (www.mydomain.com/city/). </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var lnk = "";
  if (window.location.href.match("city")) {
     lnk = "aqer123";
     } else if (window.location.href.match("country")) {
         lnk = "aber321";
         }
  </code></pre>
  
  <p>Then this "lnk" variable should becomes the value of disqus_shortname</p>
  
  <pre><code>var disqus_shortname = 'lnk'; // required: replace example with your forum shortname
  
  /* * * DON'T EDIT BELOW THIS LINE * * */
  (function () {
      var s = document.createElement('script'); s.async = true;
      s.type = 'text/javascript';
      s.src = '//' + disqus_shortname + '.disqus.com/count.js';
      (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
  }());
  &lt;/script&gt; 
  </code></pre>
  
  <p>It is not working. Is there an alternative way of populating variable according to subdomain? Any help would be great.</p>