Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

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

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
rbudj
Asked:
rbudj
  • 3
  • 2
1 Solution
 
ycTINCommented:
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
 
ycTINCommented:
DNS redirect can do this same
0
 
rbudjAuthor Commented:
this website has more than a hundred pages.  I do not wish place code in each page.  
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Bruce PieterseTechnical LeadCommented:
Hi rbudj,

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

Ciao
0
 
rbudjAuthor Commented:
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
 
rbudjAuthor Commented:
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now