This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

www to non www issue
#1
[Not Solved] www to non www issue
Hello Moderator and Admin
and All member.

I have Zpanel Ver. 10.1.1 control panel running on my VPS.
I have a problem that every www domain always direct to non www domain.
Like if i type in web browser http://www.mysite.com it is always direct to mysite.com.
Is it any solution to solve that problem and even reverse the "www to non www" become
"non www to www"

Thank you verymuch for your kind attention.
Reply
Thanks given by:
#2
[Not Solved] RE: www to non www issue
in your .htaccess file, use one of two forms:

www to non-www:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.*) [NC]
RewriteRule ^(.*) http://%1/$1 [R=301,L]

non-www to www:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yousite.com
RewriteRule ^ http://www.yousite.com%{REQUEST_URI} [L,R=301]
Reply
Thanks given by:
#3
[Not Solved] RE: www to non www issue
Just keep in mind that you really should commit to using one or the other though (either always http://www.domain.com or http://domain.com), and simply redirect the other form to the one you choose to standardize on (this is how zpanel/sentora does it by default). If your content is accessible by both methods, it will be crawled by search engines as if the www page and the non-www are two different pages, BUT have the same exact content (www is just a subdomain afterall). As a result, this appears to the search engines as redundant content, and can seriously hurt your search engine ranking. The trend for most sites lately has been to go with the non-www form. It's the one I prefer too. It makes for a little bit shorter urls, and like I said previously, it's how zpanel/sentora is setup by default.
Reply
Thanks given by:
#4
[Not Solved] RE: www to non www issue
(01-20-2015, 01:23 PM)13.supriadi Wrote: Hello Moderator and Admin
and All member.

I have Zpanel Ver. 10.1.1 control panel running on my VPS.
I have a problem that every www domain always direct to non www domain.
Like if i type in web browser http://www.mysite.com it is always direct to mysite.com.
Is it any solution to solve that problem and even reverse the "www to non www" become
"non www to www"

Thank you verymuch for your kind attention.

This is not zpanel setting involved here.

Check your .htaccess in your domain, it's likely doing the domain redirection or it might be in your php files enforcing the domain without www, but in any case zpanel involved.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask
Coldfusion Freelance

10$ free to start your VPS

Reply
Thanks given by:
#5
[Not Solved] RE: www to non www issue
Thank for all of your reply.

I try to follow the suggestion of Finallf . I try to create .htaccess in my domain directory because there is no
such file even in a hidden file.
But i get an error like this

"The webpage at http://www.aufaweb.com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
Learn more about this problem.
Error code: ERR_TOO_MANY_REDIRECTS "

May be Kellenw is right that zpanel force the user to use the non www. But i don't where is the configuration of that.
Reply
Thanks given by:
#6
[Not Solved] RE: www to non www issue
you have likely the redirect in php files already so you end up with an infinite loop. You need to disable the redirection first before reverting it using .htacess.

And again Zpanel settings not involved here it's embedded in your application code!

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask
Coldfusion Freelance

10$ free to start your VPS

Reply
Thanks given by:
#7
[Not Solved] RE: www to non www issue
(01-21-2015, 08:15 PM)13.supriadi Wrote: Thank for all of your reply.

I try to follow the suggestion of Finallf . I try to create .htaccess in my domain directory because there is no
such file even in a hidden file.
But i get an error like this

"The webpage at http://www.aufaweb.com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
Learn more about this problem.
Error code: ERR_TOO_MANY_REDIRECTS "

May be Kellenw is right that zpanel force the user to use the non www. But i don't where is the configuration of that.

With Sentora 1.03 when you check override port 80 to 443 in the apache admin module for the virtual host it creates a RewriteRule in the vhost config that rewrites everything to non-www. I have been wrestling with this for like 24 hours  Huh

Code:
# DOMAIN: ogzcreative.com
# PORT FORWARD FROM 80 TO: 443
<virtualhost *:80>
ServerName ogzcreative.com
ServerAlias www.ogzcreative.com
ServerAdmin server@ogzcreative.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</virtualhost>
# END DOMAIN: ogzcreative.com

After which if i try to rewrite or redirect to a www prefixed subdomain I get too many redirects  Confused If I edit this file directly it will be overwritten the next time it is generated. What to do? What to do?
Reply
Thanks given by:


Possibly Related Threads...
Thread Author Replies Views Last Post
sentora centered issue with installing an smf forum rivendell 3 2,040 06-22-2017, 03:55 AM
Last Post: TGates
Email forwards - weird issue. dipakcg 1 1,598 08-14-2016, 09:13 PM
Last Post: Me.B
Domain pointing issue - ERR_NAME_NOT_RESOLVED kamal 4 4,039 02-17-2016, 04:56 AM
Last Post: TGates

Forum Jump:


Users browsing this thread: 1 Guest(s)