Link to home
Start Free TrialLog in
Avatar of rbudj
rbudjFlag for United States of America

asked on

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?
Avatar of ycTIN
ycTIN
Flag of Hong Kong image

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

DNS redirect can do this same
Avatar of rbudj

ASKER

this website has more than a hundred pages.  I do not wish place code in each page.  
Avatar of Bruce Pieterse
Hi rbudj,

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

Ciao
Avatar of rbudj

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of rbudj
rbudj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial