Dynadot — .com Registration $8.99

URL redirection/forwarding

Spaceship Spaceship
Watch

peterstannard

Account Closed
Impact
5
Basically I need all requests for one domain to be forwarded to another.

The domain I want to forward is registered @ Namecheap and I have used their URL forwarding feature but this only appears to forward the main URL (eg: When I type in www.domain.com its forwarded perfectly, but if I type in www.domain.com/folder then I receive a 404 error.)

Is it possible to forward all requests for the domain using Namecheap or if not can I does this using my cPanel hosting account and how?
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
yes, you can do a 301 redirection on your cpanel..just add this line on your htaccess file..

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
 
1
•••
I have most of my sites set up like this as I think it is better than a customer 404 page which is useless, IMO. I have all requests for nonexitent folders go to the homepage instead of a custom 404 page. However the code I use in my .HTACCESS file is different. Just one line...

Code:
ErrorDocument 404 /

Not sure if the 301 above redirect is better or not, though.

Oh, BTW, I'm don't think this is possible with NameCheap forwarding. But you should ask them and let us know what they say. :)
 
1
•••
it is not a good idea to redirect a 404 page to the main site, IMHO..
 
0
•••
bentong said:
it is not a good idea to redirect a 404 page to the main site, IMHO..

Can you explain why?
 
0
•••
EbookLover said:
Can you explain why?

Because customers would wonder why they are clicking a link (to the "about us" page for eg) and it keeps taking them back to the homepage.

Ebook: Would the ErrorDocument code look like this;
Code:
ErrorDocument 403 http://domain.com
or like this;
Code:
ErrorDocument 403 /http://domain.com
?
 
Last edited:
0
•••
You are misunderstanding. If they go to the "About Us" page and that page does in fact exist then they would go to the "About Us" page, not the homepage.

The code I mentioned above...

Code:
ErrorDocument 404 /

Will only forward them to the homepage is the page or subfolder they are trying to access does not exist (aka 404).

What that means is that IF visitors goes to a page that does nto exist THEN redirect to "/" which is the homepage.

For an example go to the first link in my sig. Once there type in a randome subfolder that does not exist like "sdfsdfsdf". You will be redirected to the homepage. But click on any link on the site and you will be taken to the page the link points to, not the homepage.


So, for instance, if you wanted them to be redirected to a specific page instead, like a custom 404 error page (which I don't like but may have it's advantages), and that eorroe page was located at http://www.YOURDOMAIN.com/error_page/index.html then your .HTACCESS code would be...

Code:
ErrorDocument 404 /error_page
 
Last edited:
0
•••
Thanks guys. Sorted it now. I've added you some rep been really helpful.
 
0
•••
Thanks for the rep. So what did you end up doing?
 
0
•••
0
•••
0
•••
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back