Stopping redirection from www.mydomain.com to mydomain.com

6 posts / 0 new
Last post
#1 Mon, 08/13/2012 - 17:46
plasticgoat

Stopping redirection from www.mydomain.com to mydomain.com

Hello !

Currently webmin (Apache I think), is redirecting "www.mydomain.com" to "mydomain.com", I want to do the opposite ...

I have my domain purchased on Gandi.net, DNS Zone are managed there, and I'm hosting my blog on an other platform, with Virtualmin/Webmin. I have disabled BIND DNS Server in Virtualmin.

Do you know what do I have to change, and where, in order to reverse the redirection ? In webmin settings or in Apache virtual host directive ?

At least I would like to be able to access my website on "www.mydomain.com", rather than "mydomain.com"

Thank you :)

Mon, 08/13/2012 - 22:05
andreychek

Howdy,

Hmm, by default, I don't think Virtualmin configures Apache to do any redirection; it should allow you to access your domain using whatever name you type in.

Is it possible that it's your website itself doing that?

Or perhaps a .htaccess file in your public_html folder?

-Eric

Tue, 08/14/2012 - 07:46
plasticgoat

Hello,

Thanks for your reply :)

If Virtualmin or Apache is not doing that, it might be my website. The only difference with my other domain and subdomain that are working properly, is that, on that one I have installed and activate Wordpress Network (Multi-site) instead of a single blog install.

I'll have a look on Wordpress side, but I don't know where this redirection could be done ...

Here is content of my .htaccess in public_html :

BEGIN WordPress

RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L]

uploaded files

RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule . index.php [L]

END WordPress

Thanks :)

Tue, 08/14/2012 - 10:01
andreychek

Howdy,

Well, I don't see anything in that which causes a domain name change.

You could always try creating a test page -- say, test.html, temporarily remove your .htaccess file (although I don't think it's the cause, that'll rule it out), and try loading that test page to see if it redirects.

-Eric

Tue, 08/14/2012 - 12:08
plasticgoat

I already had test without the .htaccess and I had the same problem.

But, as you said, I tried to access directly a file, the wordpress readme.html and it works. It's when the index.php is executed that I am redirected.

So it's definitely a Wordpress issue, sorry for bothering you ;)

And thanks for your help !

:)

Wed, 08/15/2012 - 06:43
Locutus

Like Eric said correctly, Virtualmin configures Apache with "ServerName" and "ServerAlias" for your domain, "example.com" and "www.example.com". That means to Apache those two names are identical, it reacts to both the same way, and doesn't do any redirection.

With Wordpress, like with other blogs/CMSes, it's quite probable that the blog itself does the redirection in the PHP code. Most of those softwares have a configuration option where you set its "Base URL" or something. They will usually redirect any requests they get to that hostname, so if you want to get rid of the "www", just remove it from there, and the code will redirect properly. :)

Topic locked