{"id":2560,"date":"2022-06-25T08:06:30","date_gmt":"2022-06-25T08:06:30","guid":{"rendered":"https:\/\/www.arzhost.com\/?p=1697"},"modified":"2025-09-11T15:19:38","modified_gmt":"2025-09-11T10:19:38","slug":"htaccess-redirect-url-to-another-url","status":"publish","type":"post","link":"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/","title":{"rendered":"Htaccess redirect URL to another URL"},"content":{"rendered":"<p><strong>\u00a0<\/strong>First of all you can create an .htaccess file on your web server. you can create file using FTP and SSH. Here you can use FTP because it is easy as compare to command line. These are the other FTP clients you can use for <a href=\"https:\/\/www.arzhost.com\/htaccess-redirect-url-to-another-url\/\">htaccess redirect URL to another URL:<\/a><\/p>\n<ul>\n<li>File zilla<\/li>\n<li>WinSCP<\/li>\n<li>Cyberduck<\/li>\n<li>CrossFTP<\/li>\n<li>FlashFSP<\/li>\n<li>CuteFTP<\/li>\n<li>FireFT<\/li>\n<li>Jscape<\/li>\n<\/ul>\n<p>Here you can use <strong>file zilla<\/strong> for <a href=\"https:\/\/www.arzhost.com\/htaccess-redirect-url-to-another-url\/\">htaccess redirect URL to another URL<\/a>. Using file zilla you can see that how to create or delete a file and edit it. you should download file zilla. Here is the link of file zilla. (<a href=\"https:\/\/filezilla-project.org\/download.php?platform=win64\" target=\"_blank\" rel=\"noopener\">https:\/\/filezilla-project.org\/download.php?platform=win64<\/a>).using this link you can download file zilla.<\/p>\n<ul>\n<li>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-grey 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: #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><\/span><\/a><\/span><\/div>\n<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:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#How_to_create_file\" >How to create file?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#How_to_edit_file\" >How to edit file?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#How_to_delete_file\" >How to delete file?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#how_htaccess_redirect_url_to_another_url\" >how htaccess redirect url to another url?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Redirect_all_URLS\" >Redirect all URLS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Redirect_a_single_URL\" >Redirect a single URL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Redirect_directory_to_HTML_file\" >Redirect directory to HTML 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:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Redirecting_indexhtml_files_to_different_directories\" >Redirecting index.html files to different directories<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#How_to_load_a_gif_file_from_a_different_site\" >How to load a .gif file from a different site<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Redirect_error_massage\" >Redirect error massage<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Redirecting_non-existing_page_to_indexphp\" >Redirecting non-existing page to index.php<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Enforcing_www_in_URL\" >Enforcing www in URL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#Remove_www_in_URL\" >Remove www in URL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/arzhost.com\/blogs\/htaccess-redirect-url-to-another-url\/#10_Rewriting_non-existing_links_indexphp\" >10. Rewriting non-existing links index.php<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_to_create_file\"><\/span><strong>How to create file?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ul>\n<ol>\n<li>Login to server using <strong>FTP <\/strong><\/li>\n<li>Ensure that FTP client show hidden files<\/li>\n<li>When you are login you must ensure that you are in correct directory or not. you can see that in image you are in remote title. And directory address is \/home\/example_username\/arzhost.com.<\/li>\n<li>Right click and create new file.<\/li>\n<\/ol>\n<p><img fetchpriority=\"high\" decoding=\"async\" title=\"Nagios Service Check Timed Out : How to Fix It\" class=\"size-full wp-image-1698 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/2020-11-05_11-29-15.png\" alt=\"step 1 create new file\" width=\"545\" height=\"489\" \/><\/p>\n<p>5. you can see a prompt here you enter the file name <strong>.htaccess<\/strong>. Click on ok and save it.<strong>\u00a0 \u00a0\u00a0<\/strong><img decoding=\"async\" title=\"Nagios Service Check\" class=\"wp-image-1700 size-full aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/file-name-1.png\" alt=\"step 5 file name\" width=\"519\" height=\"333\" \/><\/p>\n<p>6.you can see that an .htaccess file which is empty.<\/p>\n<p><img decoding=\"async\" title=\"Nagios Service Check Timed Out\" class=\"size-full wp-image-1701 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/file-size.png\" alt=\"step 5 file size\" width=\"422\" height=\"156\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_edit_file\"><\/span><strong>How to edit file?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>How to edit and delete file follow these steps:<\/p>\n<p>7. Move the cursor on .htaccess file right click on file and click on view or edit.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"edit file\" class=\"size-full wp-image-1702 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/edit-file.png\" alt=\"step 7 edit file\" width=\"545\" height=\"489\" \/><\/p>\n<p>8. In prompt you can see that he asking that which editor you want to choose. you can choose your own editor which is install in our system. But here you choose default editor notepad, because it is easy to use.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Nagios Service Check Timed Out\" class=\"size-full wp-image-1703 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/choose-editor.png\" alt=\"step 8 choose editor\" width=\"637\" height=\"462\" \/><\/p>\n<p>9. Now open the file and add any txt on notepad.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Couldn&#8217;t Create the Outlook Data File &#8211; How do we fix it?\" class=\"size-full wp-image-1704 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/add-text.png\" alt=\"step 5 add text\" width=\"658\" height=\"425\" \/><\/p>\n<p>10. Click on file and save it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Couldnt Create the Outlook Data File\" class=\"size-full wp-image-1705 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/save-file.png\" alt=\"step 10 save file\" width=\"658\" height=\"427\" \/><\/p>\n<p>11. Within few seconds you see prompt check the box and click on <strong>yes<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Use Manage Profiles\" class=\"size-full wp-image-1706 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/check-box-for-save.png\" alt=\"step 11 check box for save\" width=\"530\" height=\"413\" \/><\/p>\n<p>Now .htaccess file is update on web server.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_delete_file\"><\/span><strong>How to delete file?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>12. When you are login your web server ensure that you are in correct directory or not.<\/p>\n<p>13. Right click on the file and choose<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Disable Simplified Account Creation\" class=\"size-full wp-image-1707 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/delete-file.png\" alt=\"step 13 delete file\" width=\"577\" height=\"394\" \/><\/p>\n<p>14. On prompt you can see that he asking him that you want to delete this file or not we click on <strong>YES.<\/strong><img loading=\"lazy\" decoding=\"async\" title=\"Couldn&#8217;t Create the Outlook Data File &#8211; How do we fix it?\" class=\"size-full wp-image-1708 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/yes-delete.png\" alt=\"step 14 yes delete\" width=\"428\" height=\"146\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"how_htaccess_redirect_url_to_another_url\"><\/span><strong>how htaccess redirect url to another url?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Redirect_all_URLS\"><\/span><strong>Redirect all URLS<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>If you want to redirect all <strong>URLS <\/strong>on your new site then you write this line.<\/p>\n<p><strong>\u00a0\u00a0Redirect 301 \/ <\/strong><a href=\"https:\/\/arzhost.com\"><strong>https:\/\/arzhost.com<\/strong><\/a><\/p>\n<ol start=\"2\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Redirect_a_single_URL\"><\/span><strong>Redirect a single URL<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>If\u00a0 want to redirect a single url then follow these steps.<\/p>\n<p><strong>For red<\/strong><strong>irect to local site file:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Couldn&#8217;t Create the Outlook Data File &#8211; How do we fix it?\" class=\"size-full wp-image-1709 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/re-direct-local-site-file.png\" alt=\"step 1 re direct local site file\" width=\"713\" height=\"36\" \/><\/p>\n<p><strong>\u00a0 Redirecting to an external site file:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Change Network from Public to Private Server 2025\" class=\"size-full wp-image-1710 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/for-external-file.png\" alt=\"step 2 for external file\" width=\"867\" height=\"36\" \/><\/p>\n<p><strong>Here are few examples of redirects<\/strong><\/p>\n<ol start=\"3\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Redirect_directory_to_HTML_file\"><\/span><strong>Redirect directory to HTML file<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>These lines will redirect the directories to an HTML file<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Change Network from Public to Private Server 2012\" class=\"size-full wp-image-1711 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/directory-to-html.png\" alt=\"step 3 directory to html\" width=\"549\" height=\"35\" \/><\/p>\n<ol start=\"4\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Redirecting_indexhtml_files_to_different_directories\"><\/span><strong>Redirecting index.html files to different directories<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>These lines redirect html index files to different directory.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Network status\" class=\"size-full wp-image-1712 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/files-to-different-directories.png\" alt=\"step 4 files to different directories\" width=\"369\" height=\"41\" \/><\/p>\n<ol start=\"5\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"How_to_load_a_gif_file_from_a_different_site\"><\/span><strong>How to load a .gif file from a different site <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>These lines load a gif files from different sites<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"network profile change from public to private in w\" class=\"size-full wp-image-1713 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/load-gif-file.png\" alt=\"step 5 load gif file\" width=\"715\" height=\"33\" \/><\/p>\n<ol start=\"6\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Redirect_error_massage\"><\/span><strong>Redirect error massage <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>you can redirect error massage 404.rather than by send a 404 page. These lines will redirect to homepage.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"set private or public network location via registr\" class=\"size-full wp-image-1714 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/redirect-error-massages.png\" alt=\"step 6 redirect error massages\" width=\"454\" height=\"36\" \/><\/p>\n<ol start=\"7\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Redirecting_non-existing_page_to_indexphp\"><\/span><strong>Redirecting non-existing page to index.php<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>If a user open page which is not exist then 404 error will present. you can redirect non-existing page to index.php by sing these lines.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Change Network from Public to Private Server 2012\" class=\"size-full wp-image-1715 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/redirect-non-existing-page.png\" alt=\"step 7 redirect non-existing page\" width=\"426\" height=\"137\" \/><\/p>\n<ol start=\"8\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Enforcing_www_in_URL\"><\/span><strong>Enforcing www in URL<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>If you want to write www in your URL address then you follow these lines of code.<img loading=\"lazy\" decoding=\"async\" title=\"Change Network from Public to Private Server 2012\" class=\"size-full wp-image-1716 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/enfocr-www-in-url.png\" alt=\"step 8 enforce www in url\" width=\"640\" height=\"92\" \/><\/p>\n<ol start=\"9\">\n<li>\n<h2><span class=\"ez-toc-section\" id=\"Remove_www_in_URL\"><\/span><strong>Remove www in URL<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/li>\n<\/ol>\n<p>If you want to remove www in our URL then there is a minor change in code. which you use to enforce www in URL .<\/p>\n<h2><span class=\"ez-toc-section\" id=\"10_Rewriting_non-existing_links_indexphp\"><\/span><strong> <img loading=\"lazy\" decoding=\"async\" title=\"Email Does Not Allow Relaying: What You Need to Know\" class=\"size-full wp-image-1717 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/remove-www-in-url.png\" alt=\"step 9 remove www in url\" width=\"583\" height=\"81\" \/><\/strong><strong>10. Rewriting non-existing links index.php<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>These lines are link to non-existing folder or files. If files or folder exist then it load automatic.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Email Does Not Allow Relaying\" class=\"size-full wp-image-1718 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/rewrite-non-existing-links.png\" alt=\"step 10 rewrite non existing links\" width=\"518\" height=\"206\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0First of all you can create an .htaccess file on your web server. you can create file using FTP and SSH. Here you can use FTP because it is easy as compare to command line. These are the other FTP clients you can use for htaccess redirect URL to another URL: File zilla WinSCP Cyberduck [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":13026,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,21,22,14,26],"tags":[],"table_tags":[],"class_list":["post-2560","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","category-buisness","category-hosting","category-news","category-server"],"_links":{"self":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/2560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/comments?post=2560"}],"version-history":[{"count":2,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/2560\/revisions"}],"predecessor-version":[{"id":13028,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/2560\/revisions\/13028"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media\/13026"}],"wp:attachment":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media?parent=2560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/categories?post=2560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/tags?post=2560"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/table_tags?post=2560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}