•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Infrastructure
      • iColocation
    • Compute
      • cMetal
      • cVirtual
    • Storage
      • sObject
      • sBlock
    • Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • Protection
      • pBackup
      • pDDoS
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • new-colocation-header-img
      Infrastructure
      • iColocation
    • new-compute-header-img
      Compute
      • cMetal
      • cVirtual
    • new-storage-header-img
      Storage
      • sObject
      • sBlock
    • new-networking-header-img
      Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • new-protection-header-img
      Protection
      • pBackup
      • pDDoS
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

How can I redirect an entire site to a single page?

  • Home
  • Client
  • Qa Forum
  • How can I redirect an entire site to a single page?

Posted By: Jie | 1 Replies | Last Reply On: Nov 05, 2020 11:25:20

I am trying to redirect all my website pages to a single page.  How can I do this with .htaccess?  or javascript? 

Psychz - Bruce

Votes: 0Posted On: Nov 05, 2020 11:25:20
 

Redirects are highly useful when you migrate a website or move a page to a new URL by ensuring that user finds appropriate destination.

Using .htaccess

You can use .htaccess if you are running apache server. You can create a file named .htaccess in any of the directory to locally override server configurations. The .htacccess file usually exist in the root directory of the website. Using a simple syntax inside this file can help you setup page, directory, or site redirects.

Let's see how you can redirect an entire website

Redirect 301 "/" "http://www.newsite.com"

Using the above syntax, the redirect assumes that everything on the new site is in the same place as it was on the old site:

Using JavaScript

If you would like to use JavaScript to redirect to a new URL or page please follow the method given below
Note: If you are planning to move your website to a separate domain, it’s better to use the server redirection because redirection using JavaScript runs entirely on the client-side and hence it does not return the status code 301 (move permanently) like server redirection.

To redirect to a new URL from the current page, you can use the location object:

location.href = 'new_url';

example:

location.href = 'https://www.newsite.com/';

You can also use

location.assign('https://www.newsite.com/');

 

Hope you find the information above useful. Please hit the like button below to show your appreciation.

Was this reply helpful?

Related topics

  • nginx redirect http to https
  • Create CDN Redirections
  • IP DDoS Protection
  • Single Server Colocation
  • Netherlands Dedicated Server
  • JSON vs XML
  • What are Redirects and Benefits of it
  • What is DDoS and How to Protect Against a DDoS Attack
  • What is Web Hosting?
  • How to create firewall (Edgelayer) rules?
  • History of Internet
  • CDN Hosting and why Every website should utilize a CDN
  • How To Setup Application Load Balancer Using CDN
  • Psychz CDN Products and Features Updates
  • Benefits of a multi-CDN environment
Copyright © 2025 Psychz Networks,
A Profuse Solutions Inc Company
Hosting Services
Infrastructure
  • iColocation
Compute
  • cMetal
  • cVirtual
Storage
  • sObject
  • sBlock
Networking
  • nCDN
  • nIP Transit
  • nWavelength
Protection
  • pBackup
  • pDDoS
Company
  • About Us
  • Blog
  • Careers
  • Contact Us
  • Data Centers
  • Looking Glass
  • Network
  • Reseller
Policies
  • Acceptable Usage Policy
  • Privacy Policy
  • Service Level Agreement
  • Terms and Conditions
Support
  • Community
  • Knowledge Base
  • Open A Ticket
Get In Touch
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801