Domain Forwarding

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
User avatar
dillmc7743
A semi-regular
A semi-regular
Posts: 19
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Thu Jul 30, 2009 11:13 am

Domain Forwarding

Post by dillmc7743 »

Original Question
------
What would i add if i want my domain to point to www. when some one puts in some thing like doiclan.com/donate have it point to www.doiclan.com/donate, i want www. to be automatically be put in when some one enters in doclan.com/whatever
------
As of now i got it to where the domain points to www.doiclan.com when you type in doiclan.com, and when you type in doiclan.com/donate it would point to http://www.doiclan.com/donate, i've got it that far.

I'm looking for the same domain forwarding as xfire.com has it, where if you where to typein xfire.com/profile/dillmc7743 it would forward to http://www.xfire.com/profile/dillmc7743
-----

Now that you have the idea what I'm doing, here is where it runs into problems.
Here's my question:
-----
Quick question, some of our users are experiencing some error's when trying to get on (i.e. Chrome, Opera, IE) where it tells them that service is unavailable or has timed out, i assume that this is caused by the forwarding, how can this be resolved, but still having the forwarding effects that work in Firefox?
-----
User avatar
Edge100x
Founder
Founder
Posts: 12961
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Domain Forwarding

Post by Edge100x »

If you need to have the entire URL transformed, you'll have to use mod_rewrite, as I mentioned to another customer in this thread: http://www.nfoservers.com/forums/viewto ... 46&start=6

In your particular case, you would need to turn off "Forward" mode (if you're using it) and creating an .htaccess file in the folder that you point doiclan.com to (which can be the same folder that www.doiclan.com points to), containing something like this:

Code: Select all

RewriteEngine on
RewriteCond %{HTTP_HOST}    ^doiclan.com$ [NC]
RewriteRule ^(.*)$          http://www.doiclan.com/$1 [R=301,L]
This will work in all browsers and is the solution preferred by search engines like Google.
User avatar
dillmc7743
A semi-regular
A semi-regular
Posts: 19
Joined: Thu Jul 30, 2009 11:13 am

Re: Domain Forwarding

Post by dillmc7743 »

thanks for the reply, another question.

i have serveral thinngs in that file, does "RewriteEngine on" need to be placed in front of anything that needs it, or does only need to be in there once?

Example:

Code: Select all

RewriteEngine on
RewriteCond %{HTTP_HOST}    ^doiclan.com$ [NC]
RewriteRule ^(.*)$          http://www.doiclan.com/$1 [R=301,L]]
ErrorDocument 400 /forums/error.php?mode=400
ErrorDocument 401 /forums/error.php?mode=401
ErrorDocument 403 /forums/error.php?mode=403
ErrorDocument 404 /forums/error.php?mode=404
ErrorDocument 500 /forums/error.php?mode=500
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9\-\+]+)$ ./page.php?p=$1 [L]
DirectoryIndex portal.php index.php index.html index.htm
RewriteCond %{HTTP_REFERER} !^$                                  
RewriteCond %{HTTP_REFERER} !^https?://www.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://dillmc7743.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://sniper.doiclan.com/.*$ [NC]
RewriteRule .*\.gif$        -                            [F]
RewriteCond %{HTTP_REFERER} !^$                                  
RewriteCond %{HTTP_REFERER} !^https?://www.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://dillmc7743.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://sniper.doiclan.com/.*$ [NC]
RewriteRule .*\.png$        -                            [F]
RewriteCond %{HTTP_REFERER} !^$                                  
RewriteCond %{HTTP_REFERER} !^https?://www.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://dillmc7743.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://sniper.doiclan.com/.*$ [NC]
RewriteRule .*\.jpg$        -                            [F]
RewriteCond %{HTTP_REFERER} !^$                                  
RewriteCond %{HTTP_REFERER} !^https?://www.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://dillmc7743.doiclan.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://sniper.doiclan.com/.*$ [NC]
RewriteRule .*\.gif$        -                            [F]
Also could you check to see if the image blocking technique works in this?
User avatar
dillmc7743
A semi-regular
A semi-regular
Posts: 19
Joined: Thu Jul 30, 2009 11:13 am

Re: Domain Forwarding

Post by dillmc7743 »

i went to try it w/o any forwarding and it hasn't work
User avatar
dillmc7743
A semi-regular
A semi-regular
Posts: 19
Joined: Thu Jul 30, 2009 11:13 am

Re: Domain Forwarding

Post by dillmc7743 »

ugh can't edit post, any way this is what i get:

Code: Select all

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, monguse@comcast.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache Server at doiclan.com Port 80
And when there is no forwarding all the images from the theme disappear, help?
User avatar
Edge100x
Founder
Founder
Posts: 12961
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Domain Forwarding

Post by Edge100x »

That is certainly a complicated file. Are you sure you need all the other Rewrite things?

With an internal server error, your error_log (available on your "File manager" page or downloadable through SFTP) should shed some light on what the problem is.
User avatar
dillmc7743
A semi-regular
A semi-regular
Posts: 19
Joined: Thu Jul 30, 2009 11:13 am

Re: Domain Forwarding

Post by dillmc7743 »

ok i found the problem, and the absolute fix that works on all browsers (IE, FireFox, Chrome, and Opera)

The rewrite code had an extra "]" in it.

-------- The Correct Forwarding

To forward a domain from yourwebsite.com to http://www.yourwebsite.com or http://www.wesite.com put this into your .htaccess

Code: Select all

RewriteEngine on
RewriteCond %{HTTP_HOST}    ^yourwebsite.com$ [NC]
RewriteRule ^(.*)$          http://www.yourwebsite.com/$1 [R=301,L]
this will also forward your domain if it is used as: yourwebsite.com/forums it will forward to http://www.yourwebsite.com/forums.

In your CP you must have it set like this
ds.png
ds.png (4.22 KiB) Viewed 2379 times
Make sure your "@" and "www" in the sub-domains point to your main page.

Note: your folders can be different, just make sure it points to the correct folder where your main page is.

So far with IE, FireFox, Chrome, and Opera it works correctly.
User avatar
Edge100x
Founder
Founder
Posts: 12961
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Domain Forwarding

Post by Edge100x »

I'm scratching my head here, because that seems to be exactly what I said to do :). The code I gave you did not have the extra bracket, and that's also how I said the domain should be set up.
User avatar
dillmc7743
A semi-regular
A semi-regular
Posts: 19
Joined: Thu Jul 30, 2009 11:13 am

Re: Domain Forwarding

Post by dillmc7743 »

oh! my pardens, i didn't understand, you can delete this topic then. I see it now, i hadn't fix the file.
User avatar
Edge100x
Founder
Founder
Posts: 12961
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Domain Forwarding

Post by Edge100x »

It's no problem, and this thread could be useful for other customers who need help troubleshooting, too, so I'll leave it :)

I will likely be changing the "Forward" option so that it does the rewrite-style redirection instead of the other kind in the future.
Post Reply