How do you redirect your website using a .htaccess file OR Set Default Page ?

How do you redirect your website using a .htaccess file?

How to set the default page for your website?


How to create a .htaccess file to redirect your website or site content to the specific URL. It does not redirect your email or any other function for your domain or website.


The .htaccess file is very power full and after editing it you can redirect your website of any file content to specific URL.

If you are using the cPanel as hosting panel

Then please follow the below Steps.

Step1. Please login to the cPanel

Step2. Select the file manager and click on it

Step3. After one small popwindow will open and there is check box with massage Show Hidden File And Folder

Step4. Please click on check Box.

Step5. After opening the File Manage Click on the public_html folder

Step6. Select the .htaccess file and click for opening in Code Editor


And then Edit as per your requirement

1. Redirect your website to any another URL

Redirect 301 / http://yourDomainName.com/


2. Redirect your default page at specific Folder or subfolder

Redirect /index.html http://YourDomainName.com/newdirectory/

Or SubFolder

Redirect /index.html http://YourDomainName.com/newdirectory/Subfolder


3. Redirect an old file to a new file path

Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html


4. Redirect to a specific index page: Set as a default or landing page for your website

DirectoryIndex index.html


Please note : Some time you did not make the file as .htaccess

So please make as htaccess.txt or with another file extension and Upload at the server and then rename it as .htaccess



 

 

  • 150 Users Found This Useful
Was this answer helpful?

Related Articles

How to See all the current running information about PHP at our Hosting server.

  For this you need to create one .php file with phpinfo() function which show you all the...

How to login in control panel (cPanel Panel) ?

How to login in control panel (cPanel Panel) After getting the login credential, there is three...

How to login to our Linux Server through Secure Shell (SSH) ?

    As per Operating SystemLinux distributions include support for SSH by default as well....

How to change or reset the default page in cPanel

How to reset the default page in cPanel For Admin for individual Account If you are having the...

How To Upload The WebSite Content (cPanel)

How to upload your website files and folders to the server or your hosting space? For uploading...

Powered by WHMCompleteSolution