title: How to change the url sent to the browser node.js
body: <p>I am trying to change the location displayed in the url bar. In my code I am being directed to a particular route through the client</p>
  
  <pre><code>    var user = "matt";
      window.location.href = "/profile/:" + user;
  </code></pre>
  
  <p>Then on my server I have tried doing this, but it just sets the response header not the actual url displayed </p>
  
  <pre><code>app.get('/profile/:user', function (req, res) {
          var user = req.param('user');
          res.setHeader("Location",user);
          res.render('profile', {
              title: 'Profile page'
          });
  })
  </code></pre>
  
  <p>So when the profile page is rendered I want the user to see mysitename/matt isntead of mysitename/profile/:user.I know it is possible on the client to manipulate the url like this</p>
  
  <pre><code>history.pushstate(null, null, '/matt')
  </code></pre>
  
  <p>But I want to change the url on the server instead, so somehow strip /profile from the url sent to the client and only have the /:user. Can someone point me in the right direction to implementing this on the server side on node.js Thanks</p>