{"id":4894,"date":"2020-04-16T20:38:52","date_gmt":"2020-04-16T20:38:52","guid":{"rendered":"https:\/\/lamp.ciscoar.com\/?page_id=4894"},"modified":"2020-12-06T00:44:28","modified_gmt":"2020-12-06T00:44:28","slug":"wordpress-and-htaccess","status":"publish","type":"page","link":"https:\/\/lamp.ciscoar.com\/?page_id=4894","title":{"rendered":"WordPress and htaccess"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\">WordPress permalinks and htaccess<\/h2>\n\n\n\n<p>When you modify the permalinks settings on your WordPress dashboard, these changes will be automatically applied to the <strong>.htaccess<\/strong> file, the below images show you how.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Empty .htaccess file<\/h2>\n\n\n\n<p>Immediately after the <a rel=\"noreferrer noopener\" href=\"\/opening-wordpress-for-the-first-time\/\" target=\"_blank\">first access<\/a> into your WordPress website you&#8217;ll find that the <strong>.htaccess<\/strong> file was created automatically and put in the root folder of your website, see image below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-01-before.png\"><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"556\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-01-before.png\" alt=\"\" class=\"wp-image-4896\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-01-before.png 766w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-01-before-300x218.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/a><figcaption>.htaccess file is created by WordPress automatically<\/figcaption><\/figure><\/div>\n\n\n\n<p>As you can see in the screenshot above, the .<strong>htaccess <\/strong>file is empty, it only has a bunch of comments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Modifying WordPress permalink settings<\/h2>\n\n\n\n<p>Let&#8217;s say you want to <a href=\"\/how-to-get-rid-of-index-php-in-wordpress-url\/\" target=\"_blank\" rel=\"noreferrer noopener\">get rid of &#8220;index.php&#8221;<\/a> from your website URLs, to achieve that you must modify the permalinks, see image below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-02-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"316\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-02-1-1024x316.png\" alt=\"\" class=\"wp-image-4900\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-02-1-1024x316.png 1024w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-02-1-300x93.png 300w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-02-1-768x237.png 768w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-02-1-1536x474.png 1536w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-02-1.png 1905w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><figcaption>WordPress changing permalinks settings<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Permalink upadted<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-03.png\"><img loading=\"lazy\" decoding=\"async\" width=\"443\" height=\"193\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-03.png\" alt=\"\" class=\"wp-image-4898\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-03.png 443w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-03-300x131.png 300w\" sizes=\"auto, (max-width: 443px) 100vw, 443px\" \/><\/a><figcaption>WordPress permalink settings updated<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">.htaccess file after the permalink changes<\/h2>\n\n\n\n<p>WordPress will do everything for you automatically, you don&#8217;t have to worry for creating the proper directives\/rules nor for applying them, WordPress will take care of everything, the only thing you must do is to make sure that both files and folder are configured properly in regards of Ownership and Permissions, you can take a look at <a href=\"\/installing-wordpress\/#WordPressorg_recommends_the_following\" target=\"_blank\" rel=\"noreferrer noopener\">this article<\/a> to learn how to configure them.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-04-after.png\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"612\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-04-after.png\" alt=\"\" class=\"wp-image-4899\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-04-after.png 768w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/04\/wordpress-create_and_modifies_htaccess-04-after-300x239.png 300w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><figcaption>WordPress modifies the .htaccess file automatically<\/figcaption><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>WordPress permalinks and htaccess When you modify the permalinks settings on your WordPress dashboard, these changes will be automatically applied to the .htaccess file, the below images show you how. Empty .htaccess file Immediately after the first access into your WordPress website you&#8217;ll find that the .htaccess file was created automatically and put in the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lamp.ciscoar.com\/?page_id=4894\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WordPress and htaccess&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-4894","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/4894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4894"}],"version-history":[{"count":8,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/4894\/revisions"}],"predecessor-version":[{"id":5746,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/4894\/revisions\/5746"}],"wp:attachment":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}