Htaccess redirect URL to another URL

 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 htaccess redirect URL to another URL:

  • File zilla
  • WinSCP
  • Cyberduck
  • CrossFTP
  • FlashFSP
  • CuteFTP
  • FireFT
  • Jscape

Here you can use file zilla for htaccess redirect URL to another URL. 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. ( this link you can download file zilla.

  1. Login to server using FTP
  2. Ensure that FTP client show hidden files
  3. 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/
  4. Right click and create new file.

step 1 create new file

5. you can see a prompt here you enter the file name .htaccess. Click on ok and save it.    step 5 file name can see that an .htaccess file which is empty.

step 5 file size

How to edit file?

How to edit and delete file follow these steps:

7. Move the cursor on .htaccess file right click on file and click on view or edit.

step 7 edit file

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.

step 8 choose editor

9. Now open the file and add any txt on notepad.

step 5 add text

10. Click on file and save it.

step 10 save file

11. Within few seconds you see prompt check the box and click on yes

step 11 check box for save

Now .htaccess file is update on web server.

How to delete file?

12. When you are login your web server ensure that you are in correct directory or not.

13. Right click on the file and choose

step 13 delete file

14. On prompt you can see that he asking him that you want to delete this file or not we click on YES.step 14 yes delete

how htaccess redirect url to another url?

  1. Redirect all URLS

If you want to redirect all URLS on your new site then you write this line.

  Redirect 301 /

  1. Redirect a single URL

If  want to redirect a single url then follow these steps.

For redirect to local site file:

step 1 re direct local site file

  Redirecting to an external site file:

step 2 for external file

Here are few examples of redirects

  1. Redirect directory to HTML file

These lines will redirect the directories to an HTML file

step 3 directory to html

  1. Redirecting index.html files to different directories

These lines redirect html index files to different directory.

step 4 files to different directories

  1. How to load a .gif file from a different site

These lines load a gif files from different sites

step 5 load gif file

  1. Redirect error massage

you can redirect error massage 404.rather than by send a 404 page. These lines will redirect to homepage.

step 6 redirect error massages

  1. Redirecting non-existing page to index.php

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.

step 7 redirect non-existing page

  1. Enforcing www in URL

If you want to write www in your URL address then you follow these lines of code.step 8 enforce www in url

  1. Remove www in URL

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 .

step 9 remove www in url10. Rewriting non-existing links index.php

These lines are link to non-existing folder or files. If files or folder exist then it load automatic.


step 10 rewrite non existing links



Flash Sale

Hurry Up! Offer ends in
00 days
20 hrs
42 mins
26 secs
Buy Now