Answers.Body: <p>Documentation for removing index.php</p>
  
  <p><a href="http://buildwithcraft.com/help/remove-index.php" rel="nofollow">http://buildwithcraft.com/help/remove-index.php</a></p>
  
  <p>You might have to adjust the .htaccess code depending on your server.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-21T10:39:38.557Z
Answers.Text: Thanks for that. My .htaccess was fine, and the problem was immediately solved by adding `'omitScriptNameInUrls' => true,`
  to the general.php file
Answers.UserDisplayName: Jack McKenzie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-21T10:22:17.597Z
Answers.LastActivityDate: 2014-08-21T10:22:17.597Z
Answers.UserDisplayName: AbbeyDesign
Body: <p>When I use {{page.link}} or {{page.url}} in a template I am getting </p>
  
  <p><a href="http://mysite.dev/index.php?p=pages/about/history" rel="nofollow">http://mysite.dev/index.php?p=pages/about/history</a> </p>
  
  <p>when what I really want is </p>
  
  <p><a href="http://mysite.dev/pages/about/history" rel="nofollow">http://mysite.dev/pages/about/history</a></p>
  
  <p>The latter URL works fine on the site, but I'm using the above code to try and create a menu, and don't want the menu item linking to the first URL.</p>
  
  <p>How do I fix this?</p>
  
Tags: <templating><url>
Title: How do I get get clean URLs in twig templates
ThreadText: # How do I get get clean URLs in twig templates
  
  (Asked by: username_0 on 2014-08-21)
  
  When I use {{page.link}} or {{page.url}} in a template I am getting
  
  <http://mysite.dev/index.php?p=pages/about/history>
  
  when what I really want is
  
  <http://mysite.dev/pages/about/history>
  
  The latter URL works fine on the site, but I'm using the above code to try and create a menu, and don't want the menu item linking to the first URL.
  
  How do I fix this?
  
  **Tags:** templating, url
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-21. Score: 3 | Accepted answer
  
  Documentation for removing index.php
  
  <http://buildwithcraft.com/help/remove-index.php>
  
  You might have to adjust the .htaccess code depending on your server.
  
  > **Comments:**
  > **username_0**: Thanks for that. My .htaccess was fine, and the problem was immediately solved by adding `'omitScriptNameInUrls' => true,` to the general.php file  
  
  ---
  
  