You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Josh Stratton <st...@gmail.com> on 2014/01/30 19:04:10 UTC

[users@httpd] virtualhost redirects to root on mobiles

I setup an apache server a while back without a virtualhost and got
everything working fine.  I added a virtualhost for my wife and it seems to
work fine on desktops, but on our phones (an iphone and a windows phone),
both redirect to my root site if the user adds www to the domain in the
address bar.  I assume it's just some mistake in my virtualhost setup, but
I don't understand why it works on desktop but not mobile.  I added a
ServerAlias to include the www prefix onto the domain and restarted apache,
but it doesn't seem to make a difference.  I always get the "root" (hope
I'm using the right naming convention) host back.

Re: [users@httpd] virtualhost redirects to root on mobiles

Posted by Otis Dewitt - NOAA Affiliate <ot...@noaa.gov>.
NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin webmaster@localhost
 ServerName www.morebearsmore.com <http://morebearsmore.com>
        ServerAlias morebearsmore.com <http://www.morebearsmore.com>


On Thu, Jan 30, 2014 at 1:30 PM, Josh Stratton <st...@gmail.com>wrote:

> I tried that.  I'm including the actual config file in sites-available if
> it helps.
>
> <VirtualHost *:80>
> ServerAdmin webmaster@localhost
>  ServerName morebearsmore.com
>         ServerAlias www.morebearsmore.com
>
> DocumentRoot /var/www/morebearsmore.com/public_html
> <Directory />
>  Options FollowSymLinks
> AllowOverride None
> </Directory>
>  <Directory /var/www/>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
>  Order allow,deny
> allow from all
> </Directory>
>
> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
> <Directory "/usr/lib/cgi-bin">
>  AllowOverride None
> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
> Order allow,deny
>  Allow from all
> </Directory>
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
>
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog ${APACHE_LOG_DIR}/access.log combined
> </VirtualHost>
>
>
>
> On Thu, Jan 30, 2014 at 10:26 AM, Otis DeWitt <ot...@noaa.gov>wrote:
>
>> Try creating a server alias and restart apache.
>>
>> <VirtualHost 192.168.1.1 172.20.30.40>
>>     DocumentRoot /www/server1
>>
>> ServerName example.com
>>     ServerAlias www.example.com</VirtualHost>
>>
>>
>> Sent from my iPhone
>>
>> On Jan 30, 2014, at 1:04 PM, Josh Stratton <st...@gmail.com>
>> wrote:
>>
>> I setup an apache server a while back without a virtualhost and got
>> everything working fine.  I added a virtualhost for my wife and it seems to
>> work fine on desktops, but on our phones (an iphone and a windows phone),
>> both redirect to my root site if the user adds www to the domain in the
>> address bar.  I assume it's just some mistake in my virtualhost setup, but
>> I don't understand why it works on desktop but not mobile.  I added a
>> ServerAlias to include the www prefix onto the domain and restarted apache,
>> but it doesn't seem to make a difference.  I always get the "root" (hope
>> I'm using the right naming convention) host back.
>>
>>
>

Re: [users@httpd] virtualhost redirects to root on mobiles

Posted by Otis Dewitt - NOAA Affiliate <ot...@noaa.gov>.
Try

NameVirtualHost *:80   "above <VirtualHost *:80>"

Thanks,
Otis



On Thu, Jan 30, 2014 at 1:30 PM, Josh Stratton <st...@gmail.com>wrote:

> I tried that.  I'm including the actual config file in sites-available if
> it helps.
>
> <VirtualHost *:80>
> ServerAdmin webmaster@localhost
>  ServerName morebearsmore.com
>         ServerAlias www.morebearsmore.com
>
> DocumentRoot /var/www/morebearsmore.com/public_html
> <Directory />
>  Options FollowSymLinks
> AllowOverride None
> </Directory>
>  <Directory /var/www/>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
>  Order allow,deny
> allow from all
> </Directory>
>
> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
> <Directory "/usr/lib/cgi-bin">
>  AllowOverride None
> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
> Order allow,deny
>  Allow from all
> </Directory>
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
>
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog ${APACHE_LOG_DIR}/access.log combined
> </VirtualHost>
>
>
>
> On Thu, Jan 30, 2014 at 10:26 AM, Otis DeWitt <ot...@noaa.gov>wrote:
>
>> Try creating a server alias and restart apache.
>>
>> <VirtualHost 192.168.1.1 172.20.30.40>
>>     DocumentRoot /www/server1
>>
>> ServerName example.com
>>     ServerAlias www.example.com</VirtualHost>
>>
>>
>> Sent from my iPhone
>>
>> On Jan 30, 2014, at 1:04 PM, Josh Stratton <st...@gmail.com>
>> wrote:
>>
>> I setup an apache server a while back without a virtualhost and got
>> everything working fine.  I added a virtualhost for my wife and it seems to
>> work fine on desktops, but on our phones (an iphone and a windows phone),
>> both redirect to my root site if the user adds www to the domain in the
>> address bar.  I assume it's just some mistake in my virtualhost setup, but
>> I don't understand why it works on desktop but not mobile.  I added a
>> ServerAlias to include the www prefix onto the domain and restarted apache,
>> but it doesn't seem to make a difference.  I always get the "root" (hope
>> I'm using the right naming convention) host back.
>>
>>
>

Re: [users@httpd] virtualhost redirects to root on mobiles

Posted by Josh Stratton <st...@gmail.com>.
I tried that.  I'm including the actual config file in sites-available if
it helps.

<VirtualHost *:80>
ServerAdmin webmaster@localhost
 ServerName morebearsmore.com
        ServerAlias www.morebearsmore.com

DocumentRoot /var/www/morebearsmore.com/public_html
<Directory />
 Options FollowSymLinks
AllowOverride None
</Directory>
 <Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
 Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
 AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
 Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>



On Thu, Jan 30, 2014 at 10:26 AM, Otis DeWitt <ot...@noaa.gov> wrote:

> Try creating a server alias and restart apache.
>
> <VirtualHost 192.168.1.1 172.20.30.40>
>     DocumentRoot /www/server1
>
> ServerName example.com
>     ServerAlias www.example.com</VirtualHost>
>
>
> Sent from my iPhone
>
> On Jan 30, 2014, at 1:04 PM, Josh Stratton <st...@gmail.com>
> wrote:
>
> I setup an apache server a while back without a virtualhost and got
> everything working fine.  I added a virtualhost for my wife and it seems to
> work fine on desktops, but on our phones (an iphone and a windows phone),
> both redirect to my root site if the user adds www to the domain in the
> address bar.  I assume it's just some mistake in my virtualhost setup, but
> I don't understand why it works on desktop but not mobile.  I added a
> ServerAlias to include the www prefix onto the domain and restarted apache,
> but it doesn't seem to make a difference.  I always get the "root" (hope
> I'm using the right naming convention) host back.
>
>

Re: [users@httpd] virtualhost redirects to root on mobiles

Posted by Otis DeWitt <ot...@noaa.gov>.
Try creating a server alias and restart apache.

<VirtualHost 192.168.1.1 172.20.30.40> DocumentRoot /www/server1 
ServerName example.com ServerAlias www.example.com</VirtualHost>

Sent from my iPhone

> On Jan 30, 2014, at 1:04 PM, Josh Stratton <st...@gmail.com> wrote:
> 
> I setup an apache server a while back without a virtualhost and got everything working fine.  I added a virtualhost for my wife and it seems to work fine on desktops, but on our phones (an iphone and a windows phone), both redirect to my root site if the user adds www to the domain in the address bar.  I assume it's just some mistake in my virtualhost setup, but I don't understand why it works on desktop but not mobile.  I added a ServerAlias to include the www prefix onto the domain and restarted apache, but it doesn't seem to make a difference.  I always get the "root" (hope I'm using the right naming convention) host back.