Solved

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

Posted on 2009-05-13
6
305 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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 the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now