Web Hosting Talk







View Full Version : Redirect all pages script?


Johnburk
06-22-2005, 05:46 AM
Is it possible to redirect every page that a person types to the main page?

Example
www.mypage.com/find.htm --> www.mypage.com

www.mypage.com/blabla.htm --> www.mypage.com

www.mypage.com/test/bla/ddd.php --> www.mypage.com

Anything that a person types redirect to main page.

I use cpanel.




p.s didn't know where to post this.

ub3r
06-22-2005, 03:03 PM
Don't bump threads.

something like this may work...


RewriteEngine On
RewriteRule (.*) http://yourpage.com

Tyler
06-22-2005, 03:14 PM
Or you simply could have your 404 redirect to your homepage, but mikey's way is probably quickest :)

SniperDevil
06-22-2005, 04:19 PM
EDIT: Err, that'd probably just redirect users infinitely.

Odd Fact
06-22-2005, 04:22 PM
Moved to programming. Looks like you have a few options.

Johnburk
06-22-2005, 04:33 PM
Originally posted by Tyler
Or you simply could have your 404 redirect to your homepage, but mikey's way is probably quickest :)

What choud I use in my 404? What code?

Thank you

VolkNet
06-22-2005, 05:07 PM
Why would you do this? Just wondering.

Johnburk
06-22-2005, 05:09 PM
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">

Is the code for 404, for people who also have my problem

Johnburk
06-22-2005, 05:14 PM
Originally posted by VolkNet
Why would you do this? Just wondering.

I used to have a community website with over 3.000 uniqe visitors a day. My old host stopped and deleten all my files :(

Yet all my users still link to me, so I needed the code to link them to my main page that explains the situation

VolkNet
06-22-2005, 06:51 PM
aww that sucks!!!

With that kind of traffic you should put some ads up and get a better host lol. ;)

Johnburk
06-23-2005, 07:00 AM
I did exactly that ;) but my own mysql backup is abit old

kneuf
06-23-2005, 07:58 AM
Try this, just put it in your main .htaccess file:

ErrorDocument 404 /index.html

index.html would be your main page, or where ever you want to direct to. This only works, though, if there is no page there, as it redirects all 404 errors.