Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to redirect all pages in a domain to one single page?

Posted on 2009-05-13
6
333 Views
Last Modified: 2012-08-13
I have a website hosted with third party.  I have cpanel.  I want all pages to redirect to one single page. This page can either be on the same domain or a different domain.  How can I do this?
0
Comment
Question by:rbudj
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:ycTIN
ID: 24381305
yes, you just need configure the 404 error page
and contains some code like below in your error page

<?php
header("location: http://google.com");
?>

Open in new window

0
 
LVL 7

Expert Comment

by:ycTIN
ID: 24381308
DNS redirect can do this same
0
 
LVL 16

Author Comment

by:rbudj
ID: 24383486
this website has more than a hundred pages.  I do not wish place code in each page.  
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 7

Expert Comment

by:brucepieterse
ID: 24383810
Hi rbudj,

Under cPanel > Domains you can "manage redirects". This can be used for a domain or a specific address.

Ciao
0
 
LVL 16

Author Comment

by:rbudj
ID: 24411344
i've been trying the redirect in cpanel.  It will only redirect the one page.  It will not redirect all files in the directory.  For example... I type in mydomain.com/  to forward to anotherdomain.com/forsale.php.  If you visit a page such as mydomain.com/hello.html... it does not redirect.  Only mydomain.com/index.html will redirect.
0
 
LVL 16

Accepted Solution

by:
rbudj earned 0 total points
ID: 24413801
This is the only thing I have found that works.  In my .htaccess file... I added the following...

RewriteEngine on
RewriteRule (.*) http://www.mydomain/thepage.html [R=302,L]
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hide un-named HTML Label with CSS 14 36
Obtaining data on ASP 8 28
SSRS 2016 Rendering HTML tables 3 26
Delete  php pages of a part of our site 8 31
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question