{"id":22972,"date":"2017-07-27T07:34:44","date_gmt":"2017-07-27T12:34:44","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=22972"},"modified":"2022-06-03T03:42:04","modified_gmt":"2022-06-03T08:42:04","slug":"set-up-wordpress-with-optimal-htaccess-settings","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/","title":{"rendered":"Set Up WordPress with Optimal .htaccess Settings"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p><img decoding=\"async\" class=\"alignnone size-full wp-image-24861\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg\" alt=\"Set Up WordPress with Optimal .htaccess Settings\" width=\"1200\" height=\"600\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg 1200w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-150x75.jpg 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-300x150.jpg 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-768x384.jpg 768w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-1024x512.jpg 1024w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-860x430.jpg 860w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-680x340.jpg 680w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-500x250.jpg 500w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-400x200.jpg 400w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-200x100.jpg 200w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings-50x25.jpg 50w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><br \/>\nIf you are a WordPress user then you probably have met the .htaccess file. The .htaccess file allows you to make configuration changes on a per-directory basis and it is very useful in case you want to enable\/disable additional functionality and features for your site. In this tutorial, we are going to show you how to set up a basic WordPress site with optimal .htaccess settings on a <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting.html\">VPS running Ubuntu 16.04<\/a> as an operating system.<\/p>\n<p><!--more--><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_1 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69c326157ca34\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69c326157ca34\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#1-Update-the-packages-on-Ubuntu\" >1. Update the packages on Ubuntu<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#2-Install-WordPress-on-Ubuntu\" >2. Install WordPress on Ubuntu<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#3-Create-a-MySQL-database\" >3. Create a MySQL database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#4-Configure-wp-configphp\" >4. Configure\u00a0wp-config.php<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#5-Create-and-Configure-Virtual-host\" >5. Create and Configure Virtual host<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#6-Optimal-htaccess-settings-for-WordPress\" >6. Optimal .htaccess settings for WordPress<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#7-Protect-the-htaccess-File\" >7.\u00a0Protect the .htaccess File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#8-Protect-the-wp-configphp-File\" >8.\u00a0Protect the wp-config.php File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#9-Other-Settings\" >9. Other Settings<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"1-Update-the-packages-on-Ubuntu\"><\/span>1. Update the packages on Ubuntu<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>It is very important to keep all your software up to date, so once you <a href=\"https:\/\/www.rosehosting.com\/blog\/connect-to-your-linux-vps-via-ssh\/\" rel=\"noopener\">connect to your Linux VPS via SSH<\/a> update the software to the latest version by using the following commands:<\/p>\n<pre>sudo apt-get update\r\nsudo apt-get upgrade<\/pre>\n<p>It is also possible to <a href=\"https:\/\/www.rosehosting.com\/blog\/how-to-enable-automatic-updates-on-a-linux-vps\/\" rel=\"noopener\">enable automatic updates on an Ubuntu VPS<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"2-Install-WordPress-on-Ubuntu\"><\/span>2. Install WordPress on Ubuntu<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>First of all, create a directory for the WordPress files and download the latest version of WordPress:<\/p>\n<pre>sudo mkdir \/var\/www\/html\/wordpress\r\ncd \/var\/www\/html\/wordpress\r\nsudo wget https:\/\/wordpress.org\/latest.zip<\/pre>\n<p>Extract the archive and set the proper ownership:<\/p>\n<pre>sudo unzip latest.zip\r\nsudo mv wordpress\/* .\r\nsudo rm -rf latest.zip wordpress\r\nsudo mv wp-config-sample.php wp-config.php\r\nsudo chown -R www-data: \/var\/www\/html\/wordpress<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"3-Create-a-MySQL-database\"><\/span>3. Create a MySQL database<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Next step is to create a MySQL database and user for the new WordPress site. Log in to the <a href=\"https:\/\/www.rosehosting.com\/mysql-hosting.html\" rel=\"noopener\">MySQL database server<\/a>:<\/p>\n<pre>mysql -u root -p<\/pre>\n<p>Run the following commands:<\/p>\n<pre>mysql&gt; CREATE DATABASE wordpressdb;\r\nmysql&gt; GRANT ALL PRIVILEGES on wordpressdb.* to 'wordpressuser'@'localhost' identified by 'PaSsW0rD';\r\nmysql&gt; FLUSH PRIVILEGES;\r\nmysql&gt; EXIT\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"4-Configure-wp-configphp\"><\/span>4. Configure\u00a0wp-config.php<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now, edit the <code>wp-config.php<\/code> file and change the database settings:<\/p>\n<pre>\/\/ ** MySQL settings - You can get this info from your web host ** \/\/\r\n\/** The name of the database for WordPress *\/\r\ndefine('DB_NAME', 'wordpressdb');\r\n\r\n\/** MySQL database username *\/\r\ndefine('DB_USER', 'wordpressuser');\r\n\r\n\/** MySQL database password *\/\r\ndefine('DB_PASSWORD', 'PaSsW0rD');\r\n\r\n\/** MySQL hostname *\/\r\ndefine('DB_HOST', 'localhost');\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"5-Create-and-Configure-Virtual-host\"><\/span>5. Create and Configure Virtual host<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Create virtual host for the new WordPress site:<\/p>\n<pre>sudo nano \/etc\/apache2\/sites-available\/yourdomain.com.conf<\/pre>\n<p>Paste the following lines:<\/p>\n<pre>&lt;VirtualHost *:80&gt;\r\n ServerAdmin admin@yourdomain.com\r\n DocumentRoot \/var\/www\/html\/wordpress\r\n ServerName yourdomain.com\r\n ServerAlias www.yourdomain.com\r\n\r\n &lt;Directory \/var\/www\/html\/wordpress\/&gt;\r\n \tRequire all granted\r\n &lt;\/Directory&gt;\r\n \r\n ErrorLog \/var\/log\/apache2\/yourdomain.com-error_log\r\n CustomLog \/var\/log\/apache2\/yourdomain.com-access_log common\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n<p>Enable the new virtual host and reload Apache for the changes to take effect:<\/p>\n<pre>sudo a2ensite yourdomain.com.conf\r\nsudo systemctl reload apache2<\/pre>\n<p>Now you should be able to access the WordPress site via web browser by using your domain name.<\/p>\n<p><img decoding=\"async\" class=\"img-responsive alignnone size-full wp-image-22973\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp.png\" alt=\"wordpress setup\" width=\"915\" height=\"885\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp.png 915w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-150x145.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-300x290.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-768x743.png 768w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-860x832.png 860w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-680x658.png 680w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-500x484.png 500w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-400x387.png 400w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-200x193.png 200w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/wp-50x48.png 50w\" sizes=\"(max-width: 915px) 100vw, 915px\" \/><\/p>\n<p>Once you set up your administrator account, you can proceed to the .htaccess customization.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"6-Optimal-htaccess-settings-for-WordPress\"><\/span>6. Optimal .htaccess settings for WordPress<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The first thing you need to do after installing WordPress on your <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting.html\" rel=\"noopener\">Ubuntu VPS<\/a> is to <strong>customize the WordPress permalinks settings<\/strong>. This is very important thing to do since it will improve the SEO quality of your site. Open the .htaccess file using a text editor like <code>nano<\/code>:<\/p>\n<pre>sudo nano \/var\/www\/html\/wordpress\/.htaccess<\/pre>\n<p>Add the following lines:<\/p>\n<pre># BEGIN WordPress\r\n&lt;IfModule mod_rewrite.c&gt;\r\nRewriteEngine On\r\nRewriteBase \/\r\nRewriteRule ^index\\.php$ - [L]\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule . \/index.php [L]\r\n&lt;\/IfModule&gt;\r\n# END WordPress\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"7-Protect-the-htaccess-File\"><\/span>7.\u00a0<strong>Protect the .htaccess File<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The next thing you might want to do is to protect the .htaccess file itself:<\/p>\n<pre># Protect .htaccess\r\n&lt;files ~ \"^.*\\.([Hh][Tt][Aa])\"&gt;\r\norder allow,deny\r\ndeny from all\r\nsatisfy all\r\n&lt;\/files&gt;\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"8-Protect-the-wp-configphp-File\"><\/span>8.\u00a0<strong>Protect the wp-config.php File<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>While you are here you can protect the wp-config.php file too:<\/p>\n<pre># Protect WP-Config file\r\n&lt;files wp-config.php&gt;\r\norder allow,deny\r\ndeny from all\r\n&lt;\/files&gt;\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"9-Other-Settings\"><\/span>9. Other Settings<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can also <strong>disable the directory listing<\/strong> by adding the following line:<\/p>\n<pre># Disable directory listing\r\nOptions All -Indexes\r\n<\/pre>\n<p>If your are not planning to allow 3rd-party applications to connect remotely to your WordPress site, you can <strong>disable the xmlrpc.php file<\/strong> too:<\/p>\n<pre># Protect XMLRPC file\r\n&lt;Files xmlrpc.php&gt;\r\norder deny,allow\r\ndeny from all\r\n&lt;\/Files&gt;\r\n<\/pre>\n<p>When it comes to performance, you might want to <strong>enable GZIP compression<\/strong>:<\/p>\n<pre>&lt;IfModule mod_deflate.c&gt;\r\n  # Compress HTML, CSS, JavaScript, Text, XML and fonts\r\n  AddOutputFilterByType DEFLATE application\/javascript\r\n  AddOutputFilterByType DEFLATE application\/rss+xml\r\n  AddOutputFilterByType DEFLATE application\/vnd.ms-fontobject\r\n  AddOutputFilterByType DEFLATE application\/x-font\r\n  AddOutputFilterByType DEFLATE application\/x-font-opentype\r\n  AddOutputFilterByType DEFLATE application\/x-font-otf\r\n  AddOutputFilterByType DEFLATE application\/x-font-truetype\r\n  AddOutputFilterByType DEFLATE application\/x-font-ttf\r\n  AddOutputFilterByType DEFLATE application\/x-javascript\r\n  AddOutputFilterByType DEFLATE application\/xhtml+xml\r\n  AddOutputFilterByType DEFLATE application\/xml\r\n  AddOutputFilterByType DEFLATE font\/opentype\r\n  AddOutputFilterByType DEFLATE font\/otf\r\n  AddOutputFilterByType DEFLATE font\/ttf\r\n  AddOutputFilterByType DEFLATE image\/svg+xml\r\n  AddOutputFilterByType DEFLATE image\/x-icon\r\n  AddOutputFilterByType DEFLATE text\/css\r\n  AddOutputFilterByType DEFLATE text\/html\r\n  AddOutputFilterByType DEFLATE text\/javascript\r\n  AddOutputFilterByType DEFLATE text\/plain\r\n  AddOutputFilterByType DEFLATE text\/xml\r\n\r\n  # Remove browser bugs (only needed for really old browsers)\r\n  BrowserMatch ^Mozilla\/4 gzip-only-text\/html\r\n  BrowserMatch ^Mozilla\/4\\.0[678] no-gzip\r\n  BrowserMatch \\bMSIE !no-gzip !gzip-only-text\/html\r\n  Header append Vary User-Agent\r\n&lt;\/IfModule&gt;\r\n<\/pre>\n<p>Additionally, you can <strong>enable leverage browser caching<\/strong>:<\/p>\n<pre># Expires caching\r\n&lt;IfModule mod_expires.c&gt;\r\nExpiresActive On\r\nExpiresByType image\/jpg \"access 1 year\"\r\nExpiresByType image\/jpeg \"access 1 year\"\r\nExpiresByType image\/gif \"access 1 year\"\r\nExpiresByType image\/png \"access 1 year\"\r\nExpiresByType text\/css \"access 1 month\"\r\nExpiresByType application\/pdf \"access 1 month\"\r\nExpiresByType text\/x-javascript \"access 1 month\"\r\nExpiresByType application\/x-shockwave-flash \"access 1 month\"\r\nExpiresByType image\/x-icon \"access 1 year\"\r\nExpiresDefault \"access 2 days\"\r\n&lt;\/IfModule&gt;\r\n<\/pre>\n<p>This will surely improve the overall score when performing online speed tests on your WordPress site.<\/p>\n<p>If you are using an <a href=\"https:\/\/www.rosehosting.com\/ssl-certificates.html\" rel=\"noopener\">SSL certificate<\/a> for your site you will surely like to <a href=\"https:\/\/www.rosehosting.com\/blog\/how-to-redirect-http-traffic-to-https-in-nginx-and-apache\/\"><strong>redirect all HTTP traffic to HTTPS<\/strong><\/a>. Add the following lines to do so:<\/p>\n<pre>RewriteEngine On\r\nRewriteCond %{HTTPS} off\r\nRewriteRule (.*) https:\/\/%{SERVER_NAME}\/$1 [R,L]\r\n<\/pre>\n<p>There are more modifications you can do in your .htaccess file, but the ones we listed above should be enough for an optimal setup.<\/p>\n<p>Of course, you don\u2019t have to do any of this if you use one of our <a href=\"https:\/\/www.rosehosting.com\/wordpress-hosting.html\" rel=\"noopener\">WordPress Hosting<\/a> services, in which case you can simply ask our expert Linux admins to help you\u00a0<strong>set up WordPress with optimal .htaccess settings<\/strong> on your server for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n<p><strong>PS.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons below or simply leave a comment in the Comments section. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are a WordPress user then you probably have met the .htaccess file. The .htaccess file allows you to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Set Up WordPress with Optimal .htaccess Settings\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#more-22972\" aria-label=\"Read more about Set Up WordPress with Optimal .htaccess Settings\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":24861,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1710],"tags":[61,148],"class_list":["post-22972","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cms-crm-erp","tag-htaccess","tag-wordpress","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Set Up WordPress with Optimal .htaccess Settings | RoseHosting<\/title>\n<meta name=\"description\" content=\"Set Up WordPress with Optimal .htaccess Settings | RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Set Up WordPress with Optimal .htaccess Settings\" \/>\n<meta property=\"og:description\" content=\"Set Up WordPress with Optimal .htaccess Settings | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-27T12:34:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:42:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Set Up WordPress with Optimal .htaccess Settings\",\"datePublished\":\"2017-07-27T12:34:44+00:00\",\"dateModified\":\"2022-06-03T08:42:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/\"},\"wordCount\":572,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg\",\"keywords\":[\".htaccess\",\"wordpress\"],\"articleSection\":[\"CMS, CRM, ERP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/\",\"name\":\"Set Up WordPress with Optimal .htaccess Settings | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg\",\"datePublished\":\"2017-07-27T12:34:44+00:00\",\"dateModified\":\"2022-06-03T08:42:04+00:00\",\"description\":\"Set Up WordPress with Optimal .htaccess Settings | RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg\",\"width\":1200,\"height\":600,\"caption\":\"Set Up WordPress with Optimal .htaccess Settings\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Set Up WordPress with Optimal .htaccess Settings\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Set Up WordPress with Optimal .htaccess Settings | RoseHosting","description":"Set Up WordPress with Optimal .htaccess Settings | RoseHosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/","og_locale":"en_US","og_type":"article","og_title":"Set Up WordPress with Optimal .htaccess Settings","og_description":"Set Up WordPress with Optimal .htaccess Settings | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2017-07-27T12:34:44+00:00","article_modified_time":"2022-06-03T08:42:04+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Set Up WordPress with Optimal .htaccess Settings","datePublished":"2017-07-27T12:34:44+00:00","dateModified":"2022-06-03T08:42:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/"},"wordCount":572,"commentCount":1,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg","keywords":[".htaccess","wordpress"],"articleSection":["CMS, CRM, ERP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/","url":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/","name":"Set Up WordPress with Optimal .htaccess Settings | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg","datePublished":"2017-07-27T12:34:44+00:00","dateModified":"2022-06-03T08:42:04+00:00","description":"Set Up WordPress with Optimal .htaccess Settings | RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2017\/07\/Set-Up-WordPress-with-Optimal-.htaccess-Settings.jpg","width":1200,"height":600,"caption":"Set Up WordPress with Optimal .htaccess Settings"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/set-up-wordpress-with-optimal-htaccess-settings\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Set Up WordPress with Optimal .htaccess Settings"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/22972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=22972"}],"version-history":[{"count":2,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/22972\/revisions"}],"predecessor-version":[{"id":43419,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/22972\/revisions\/43419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/24861"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=22972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=22972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=22972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}