Trying to setup Wordpress on one of the virtual hosts on my ubuntu ec2 instance. Facing two issues.
-
mydomain.com
is redirecting tomydomain.com/wordpress
, when I wanted Wordpress to be rendered onmydomain.com
. - The themes are not displaying correctly, whether in
mydomain.com/wordpress
or while installing inwp-admin
. I can see the themes are present in/var/lib/wordpress/wp-content/themes
.
Browser console shows following:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "mydomain.com/wordpress/wp-content/themes/twentysixteen/genericons/genericons.css/?ver=3.4.1".
Resource interpreted as Stylesheet but transferred with MIME type text/html: "mydomain.com/wordpress/wp-content/themes/twentysixteen/style.css/?ver=4.4.2".
?ver=20160816:1 Uncaught SyntaxError: Unexpected token <
?ver=20160816:1 Uncaught SyntaxError: Unexpected token <
Context:
1) Installed Wordpress by following: https://help.ubuntu.com/community/WordPress.
2) Files in /var/www/mydomain.com/public_html/:
index.php:
<?php
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
.htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
wordpress/ -> /usr/share/wordpress
3) Content of /etc/apache2/sites-enabled/mydomain.com.conf:
ServerAdmin webmaster@localhost
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain.com/public_html
<Directory "/var/www/mydomain.com/public_html">
AllowOverride All
</Directory>
Alias /wp-content /var/lib/wordpress/wp-content
<Directory /usr/share/wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/lib/wordpress/wp-content>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
4) Content of /etc/wordpress/config-mydomain.com.php:
<?php
# Created by /usr/share/doc/wordpress/examples/setup-mysql
#...mysql entries...
define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
?>
5) Entries in mydomain.com/wordpress/wp-admin/options-general.php:
Wordpress address: mydomain.com/wordpress
Site address: mydomain.com