{"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\">https:\/\/filezilla-project.org\/download.php?platform=win64<\/a>).using this link you can download file zilla.<\/p>\n<ul>\n<li>\n<h2><strong>How to create file?<\/strong><\/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\" 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\" 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\" 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><strong>How to edit file?<\/strong><\/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\" 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\" 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\" 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\" 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\" 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><strong>How to delete file?<\/strong><\/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\" 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\" 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><strong>how htaccess redirect url to another url?<\/strong><\/h2>\n<ol>\n<li>\n<h2><strong>Redirect all URLS<\/strong><\/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><strong>Redirect a single URL<\/strong><\/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\" 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\" 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><strong>Redirect directory to HTML file<\/strong><\/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\" 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><strong>Redirecting index.html files to different directories<\/strong><\/h2>\n<\/li>\n<\/ol>\n<p>These lines redirect html index files to different directory.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" 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><strong>How to load a .gif file from a different site <\/strong><\/h2>\n<\/li>\n<\/ol>\n<p>These lines load a gif files from different sites<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" 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><strong>Redirect error massage <\/strong><\/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\" 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><strong>Redirecting non-existing page to index.php<\/strong><\/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\" 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><strong>Enforcing www in URL<\/strong><\/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\" 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><strong>Remove www in URL<\/strong><\/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><strong> <img loading=\"lazy\" decoding=\"async\" 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><\/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\" 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":[21,22,14,26,16],"tags":[],"class_list":["post-2560","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-buisness","category-hosting","category-news","category-server","category-tutorial"],"_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"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}