Dynadot โ€” .com Transfer

Help with 301 redirect?

SpaceshipSpaceship
Watch
I want to set-up a redirect for all traffic to a domain name that does not resolve to a file to go to the main page, http://www.domain.com.

For example, I want all of these to redirect to http://www.domain.com:

http://www.domain.com/unknownfile.htm
http://blahblah.domain.com
http://blahblah.domain.com/unknownfile.htm
http://domain.com
http://domain.com/unknownfile.htm

What is the exact code to implement this? I have Apache (Unix) server for hosting and use CPanel control panel. I think this is either writing something on .htaccess or something else? I have a domain name that gets about 600 visitors/day to random subdomains and files that don't exist, and want them to all redirect to the main page. Thanks!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Put this in your .htaccess file:

ErrorDocument 404 /index.html
or
ErrorDocument 404 /index.php

Regards
 
0
•••
shopperx said:
Put this in your .htaccess file:
ErrorDocument 404 /index.html


This works to redirect www.domain.com/not-a-real-file.html and domain.com/not-a-real-file.html, so thank you.

However, it doesn't redirect not-a-real-subdomain.skdomains.com to www.skdomains.com. What will do that? Thanks.

---edit---
actually this doesn't work quite right for me...
I have multiple add-on domains under this hosting. This made all of the add-on domains like "www.addondomain.com" redirect to the http://maindomain/addondomainname/index.html
 
Last edited:
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back