0

I would like to access my site both with and without using the www. Currently it only works with. Leaving out the www just goes to a blank page. Also, wp-admin just loads a blank page too.

I have set an A record for mysite.com and www.mysite.com, both pointing to my static Bitnami IP. I also have a subdomain mapped to another directory that is working just fine (conference.mysite.com and www.conference.mysite.com).

I'm using a Bitnami stack on an AWS EC2 micro instance.

Here is my httpd.conf:

ServerRoot "/opt/bitnami/apache2"
Listen 80

LoadModule authn_file_module modules/mod_authn_file.so
blah blah blah....
LoadModule php5_module        modules/libphp5.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
</IfModule>

ServerAdmin [email protected]
ServerName localhost:80
DocumentRoot "/opt/bitnami/apps/wordpress1/htdocs/"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

<Directory "/opt/bitnami/apps/wordpress1/htdocs/">
    Options Indexes MultiViews +FollowSymLinks
    LanguagePriority en
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

<FilesMatch "^\\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
ErrorLog "logs/error_log"

LogLevel warn
<IfModule log_config_module>

    LogFormat "%h %l %u %t \\"%r\\" %>s %b \\"%{Referer}i\\" \\"%{User-Agent}i\\"" combined
    LogFormat "%h %l %u %t \\"%r\\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \\"%r\\" %>s %b \\"%{Referer}i\\" \\"%{User-Agent}i\\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" common
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/opt/bitnami/apache2/cgi-bin/"
</IfModule>
<Directory "/opt/bitnami/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>

Include conf/extra/httpd-mpm.conf

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
AddType application/x-httpd-php .php .phtml
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/bitnami/python

ServerSignature Off
ServerTokens Prod

AddType application/x-httpd-php .php
PHPIniDir "/opt/bitnami/php/etc"

Include "/opt/bitnami/apps/phpmyadmin/conf/phpmyadmin.conf"
ExtendedStatus On
<Location /server-status>
  SetHandler server-status
  Order Deny,Allow
  Deny from all
  Allow from localhost
</Location>

Include "/opt/bitnami/apache2/conf/bitnami/httpd.conf"
Include "/opt/bitnami/apps/virtualhost.conf"

Here is my virtual hosts file:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin xx
    DocumentRoot "/opt/bitnami/apps/wordpress1/htdocs"
    ServerName mbird.com
    ServerAlias www.mbird.com
    ErrorLog "logs/wordpress-error_log"
    CustomLog "logs/wordpress-access_log" common
</VirtualHost>
<Directory "/opt/bitnami/apps/wordpress1/htdocs">
 Options Indexes MultiViews +FollowSymLinks
 AllowOverride All
 Order allow,deny
 Allow from all
</Directory>

### WordPress conference.mbird.com configuration ###
<VirtualHost *:80>
 ServerAdmin [email protected]
 DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
 ServerName conference.mbird.com
 ServerAlias www.conference.mbird.com
 ErrorLog "logs/confwordpress-error_log"
 CustomLog "logs/confwordpress-access_log" common
</VirtualHost>
<Directory "/opt/bitnami/apps/wordpress/htdocs">
 Options Indexes MultiViews +FollowSymLinks
 AllowOverride All
 Order allow,deny
 Allow from all
</Directory>
###

3 Answers 3

0

Maybe, you should look wordpress config concerning site domains which are being served ('MULTISITE') or setup explicit apache redirect from domain to www.domain.

2
  • Not multisite, actually too different installations. How would I do such a redirect? Mar 25, 2012 at 16:33
  • 1
    Something like <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] </IfModule> somewhere in suitable place should do the work. Also, consider changing domain to no-www in settings, as WP v2.3 and above should handle this 'canonicalization' of urls by itself (see markjaquith.wordpress.com/2007/09/25/…) Mar 25, 2012 at 17:05
0

From what I understand, you want to have 2 working sites, the www and non-www. This is not a good situation. You probably need to make a formal decision: which of www and non-www is your preferred solution? (Google Analytics and other will really love / need that)

Then make a permanent redirect of all urls from the non-preferred to preferred. This would be a "redirect 301" as suggested by Vadym.

These redirects will be installed in your vhost.conf

0

WP doesn't play nice with multiple domains, since all its links to pages, attachments and stuff are stored in its database and files, instead of using variables. Define the website's address (with or without the "www" part) and make proper permanent redirect in your webserver pointing to the correct address.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .