{"id":614,"date":"2021-07-05T08:54:25","date_gmt":"2021-07-05T13:54:25","guid":{"rendered":"https:\/\/www.knownhost.com\/kb\/?p=614"},"modified":"2021-10-27T06:17:33","modified_gmt":"2021-10-27T11:17:33","slug":"htaccess-redirects-and-rewrite-rules","status":"publish","type":"post","link":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/","title":{"rendered":".htaccess redirects and rewrite rules"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #212121;color:#212121\" 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: #212121;color:#212121\" 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><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#301_permanent_redirect\" >301 (permanent) redirect<\/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.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#302_temporary_redirect\" >302 (temporary) redirect<\/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.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#creating_the_htaccess_file_and_uploading_it_to_your_server\" >Creating the .htaccess file and uploading it to your server<\/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.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_scenarios_and_code_examples\" >Redirect scenarios and code examples<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_a_single_page_url_htmlphp_file_to_another\" >Redirect a single page URL (html\/php file) to another<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_a_folderdirectory_url_including_all_sub_contents_to_another\" >Redirect a folder\/directory URL (including all sub contents) to another<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_an_entire_domain_name_to_another\" >Redirect an entire domain name to another<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_html_files_to_php_files\" >Redirect .html files to .php files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_www_to_non-www_remove_www\" >Redirect www to non-www (remove www)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_non-www_to_www_force_www\" >Redirect non-www to www (force www)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#redirect_http_to_https_force_https\" >Redirect http to https (force https)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#useful_links\" >Useful Links<\/a><\/li><\/ul><\/nav><\/div>\n\n<p><strong>Requirements<\/strong>:\u00a0<em>This requires the mod_rewrite module in apache. This is enabled by default on all <a href=\"https:\/\/www.knownhost.com\/\">KnownHost systems<\/a>.<\/em><\/p>\n\n\n\n<p>.htaccess files can be used in a website&#8217;s document root directory (ex. \/home\/user\/public_html\/) for redirecting web site visitors from one document within your web site to another. .htaccess rules are recursive meaning that rules written in \/home\/user\/public_html\/.htaccess will apply to \/home\/user\/public_html and \/home\/user\/public_html\/test\/directory unless the specific rule is canceled out by a rule in a .htaccess file in a directory below it.<\/p>\n\n\n\n<p>There are different types of redirects that can be performed via .htaccess files. Let&#8217;s break them down and understand each type before learning how to use them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"301_permanent_redirect\"><\/span>301 (permanent) redirect<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This is the most common type and typically what you&#8217;ll want to use. While the difference between 301 and 302 is small, it is notable. 301 (permenant) indicates that the old link url (redirected&nbsp;URL) is no longer in use. Whereas the 302 redirect suggests that the old&nbsp;URL&nbsp;is temporarily offline, returning shortly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"302_temporary_redirect\"><\/span>302 (temporary) redirect<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As previously stated, the 302 redirect is a temporary redirect solution. It&#8217;s also apache&#8217;s default redirect rule. So, when determining your method\/option, you&#8217;ll need to know if it&#8217;s a permenant redirect or temporary.<\/p>\n\n\n\n<p>For all documentation\/article purposes, we will be using 301 redirects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"creating_the_htaccess_file_and_uploading_it_to_your_server\"><\/span>Creating the .htaccess file and uploading it to your server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Creating the .htaccess file, to use for 301 or 302 redirects is simple. You&#8217;ll simply need to open your favorite text\/document editor and create a new blank file. Add the relevant code\/content to the document and save the file as &#8220;htaccessrules.txt&#8221;. After you&#8217;ve confirmed the accurate rules inside the document, use your favorite&nbsp;FTP or SFTP&nbsp;Client and upload the document to your website&#8217;s document root (public_html). Once you&#8217;ve uploaded the document, simply rename it .htaccess<\/p>\n\n\n\n<p>Via SSH or the terminal, this is easily done using your favorite text editor (eg. nano or vim) by creating a new file locally.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_scenarios_and_code_examples\"><\/span>Redirect scenarios and code examples<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are some examples of some common things .htaccess rewrite or redirect rules are used for.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_a_single_page_url_htmlphp_file_to_another\"><\/span>Redirect a single page URL (html\/php file) to another<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>  Redirect 301 \/retiredpage.html http:\/\/www.knownhosttest.com\/newpage.html<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_a_folderdirectory_url_including_all_sub_contents_to_another\"><\/span>Redirect a folder\/directory URL (including all sub contents) to another<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>  RedirectMatch 301 ^\/oldname\/ http:\/\/www.knownhosttest.com\/newname\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_an_entire_domain_name_to_another\"><\/span>Redirect an entire domain name to another<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>  RedirectMatch 301 ^(.*)$ http:\/\/www.knownhosttest.com<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_html_files_to_php_files\"><\/span>Redirect .html files to .php files<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>  RedirectMatch 301 (.*)\\.html$ http:\/\/www.knownhosttest.com$1.php<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_www_to_non-www_remove_www\"><\/span>Redirect www to non-www (remove www)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>  RewriteEngine On\n  RewriteCond %{HTTP_HOST} ^www\\.knownhosttest\\.com$ &#91;NC]\n  RewriteRule ^(.*)$ http:\/\/knownhosttest.com\/$1 &#91;L,R=301]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_non-www_to_www_force_www\"><\/span>Redirect non-www to www (force www)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>  RewriteEngine On\n  RewriteCond %{HTTP_HOST} !^www\\.knownhosttest\\.com$ &#91;NC] \n  RewriteRule ^(.*)$ http:\/\/www.knownhosttest.com\/$1 &#91;L,R=301]<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"redirect_http_to_https_force_https\"><\/span>Redirect http to https (force https)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Here are two separate examples of how to do this. We can do this with Redirect in an If block:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;If \"%{HTTPS} == 'off'\"&gt;\n    Redirect permanent \"\/\" \"https:\/\/domain.tld\"\n&lt;\/If&gt;<\/code><\/pre>\n\n\n\n<p>This can also be done using Rewrite rules. It might be better to avoid that complexity, but if there are already Rewrite rules in the .htaccess file, it might be necessary to use Rewrite rules anyway:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  RewriteCond %{HTTPS} off\n  RewriteRule (.*) https:\/\/%{SERVER_NAME}\/$1 &#91;R=permanent,L]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"useful_links\"><\/span>Useful Links<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Check out this great tool for genenrating .htaccess files:&nbsp;<a href=\"http:\/\/beamusup.com\/generate-htaccess\/\">.htaccess Generator Tool<\/a>.<br>Official Apache .htaccess redirect documentation can be found here:&nbsp;<a href=\"http:\/\/httpd.apache.org\/docs\/current\/rewrite\/\">Apache Rewrite Guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirements:\u00a0This requires the mod_rewrite module in apache. This is enabled by default on all KnownHost systems. .htaccess files can be used in a website&#8217;s document root directory (ex. \/home\/user\/public_html\/) for redirecting web site visitors from one document within your web site to another. .htaccess rules are recursive meaning that rules written in \/home\/user\/public_html\/.htaccess will apply [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[181,238,123,135],"class_list":["post-614","post","type-post","status-publish","format-standard","hentry","category-getting-started","tag-apache","tag-htaccess","tag-linux","tag-litespeed"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>.htaccess redirects and rewrite rules - KnownHost<\/title>\n<meta name=\"description\" content=\"Learn more about .htaccess, how to use it to redirect URLs and manage Mod Rewrite rules on your KnownHost server.\" \/>\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.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\".htaccess redirects and rewrite rules - KnownHost\" \/>\n<meta property=\"og:description\" content=\"Learn more about .htaccess, how to use it to redirect URLs and manage Mod Rewrite rules on your KnownHost server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/\" \/>\n<meta property=\"og:site_name\" content=\"KnownHost\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-05T13:54:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-27T11:17:33+00:00\" \/>\n<meta name=\"author\" content=\"Jonathan K. W.\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan K. W.\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/\"},\"author\":{\"name\":\"Jonathan K. W.\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\"},\"headline\":\".htaccess redirects and rewrite rules\",\"datePublished\":\"2021-07-05T13:54:25+00:00\",\"dateModified\":\"2021-10-27T11:17:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/\"},\"wordCount\":498,\"keywords\":[\"apache\",\"htaccess\",\"linux\",\"litespeed\"],\"articleSection\":[\"Getting Started\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/\",\"name\":\".htaccess redirects and rewrite rules - KnownHost\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2021-07-05T13:54:25+00:00\",\"dateModified\":\"2021-10-27T11:17:33+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\"},\"description\":\"Learn more about .htaccess, how to use it to redirect URLs and manage Mod Rewrite rules on your KnownHost server.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/htaccess-redirects-and-rewrite-rules\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\".htaccess redirects and rewrite rules\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\",\"name\":\"KnownHost\",\"description\":\"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\",\"name\":\"Jonathan K. W.\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"caption\":\"Jonathan K. W.\"},\"sameAs\":[\"https:\\\/\\\/www.knownhost.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":".htaccess redirects and rewrite rules - KnownHost","description":"Learn more about .htaccess, how to use it to redirect URLs and manage Mod Rewrite rules on your KnownHost server.","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.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/","og_locale":"en_US","og_type":"article","og_title":".htaccess redirects and rewrite rules - KnownHost","og_description":"Learn more about .htaccess, how to use it to redirect URLs and manage Mod Rewrite rules on your KnownHost server.","og_url":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/","og_site_name":"KnownHost","article_published_time":"2021-07-05T13:54:25+00:00","article_modified_time":"2021-10-27T11:17:33+00:00","author":"Jonathan K. W.","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jonathan K. W.","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#article","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/"},"author":{"name":"Jonathan K. W.","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b"},"headline":".htaccess redirects and rewrite rules","datePublished":"2021-07-05T13:54:25+00:00","dateModified":"2021-10-27T11:17:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/"},"wordCount":498,"keywords":["apache","htaccess","linux","litespeed"],"articleSection":["Getting Started"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/","url":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/","name":".htaccess redirects and rewrite rules - KnownHost","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/#website"},"datePublished":"2021-07-05T13:54:25+00:00","dateModified":"2021-10-27T11:17:33+00:00","author":{"@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b"},"description":"Learn more about .htaccess, how to use it to redirect URLs and manage Mod Rewrite rules on your KnownHost server.","breadcrumb":{"@id":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.knownhost.com\/kb\/htaccess-redirects-and-rewrite-rules\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.knownhost.com\/kb\/"},{"@type":"ListItem","position":2,"name":".htaccess redirects and rewrite rules"}]},{"@type":"WebSite","@id":"https:\/\/www.knownhost.com\/kb\/#website","url":"https:\/\/www.knownhost.com\/kb\/","name":"KnownHost","description":"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.knownhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b","name":"Jonathan K. W.","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","caption":"Jonathan K. W."},"sameAs":["https:\/\/www.knownhost.com"]}]}},"_links":{"self":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/comments?post=614"}],"version-history":[{"count":0,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/614\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/media?parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/categories?post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/tags?post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}