Solved

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

Posted on 2009-05-13
6
343 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
[X]
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
  • 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 7

Expert Comment

by:Bruce Pieterse
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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to dynamically set the form action using jQuery.

710 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