Oceanic_Panda Oceanic_Panda - 3 years ago 70
Apache Configuration Question

Can't get anything other than a 404 after creating a new wordpress page

Can anyone please help here?

I have the latest apache2 and wordpress installed on Ubuntu 16.04. My problem is that I cannot create a new page in wordpress and then have access to it in my browser i.e. example.net/newpage I just get a 404, I have check my permalink settings and they are set properly. Wordpress says the page is created, and I can edit it no problem within the wordpress interface, I can also view it if it's just saved as a draft, as soon as I publish I get a 404.

My wordpress virtualhost settings:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName example.net
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/html/wp-content>
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


The logs from "tail -f /var/log/apache2/access.log" when I create the new page then try to access it straight away:

$myip - - [24/Jul/2017:16:57:04 +0200] "POST /wp-admin/post.php HTTP/1.1" 302 520 "http://example.net/wp-admin/post-new.php?post_type=page&wp-post-new-reload=true" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"
$myip - - [24/Jul/2017:16:57:04 +0200] "GET /wp-admin/post.php?post=12&action=edit&message=6 HTTP/1.1" 200 26740 "http://example.net/wp-admin/post-new.php?post_type=page&wp-post-new-reload=true" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"
$myip - - [24/Jul/2017:16:57:05 +0200] "GET /wp-admin/admin-ajax.php?action=oembed-cache&post=12 HTTP/1.1" 200 382 "http://example.net/wp-admin/post.php?post=12&action=edit" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"
$myip - - [24/Jul/2017:16:57:08 +0200] "GET /newpage/ HTTP/1.1" 404 507 "http://example.net/wp-admin/post.php?post=12&action=edit" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0"


For folder and file permissions I ran:

find /var/www/html/ -type d -exec chmod 755 {} \; && find /var/www/html/ -type f -exec chmod 644 {} \;


I have tried everything I can think of including setup tutorials and reinstalling wordpress and mysql from the beginning but to no avail.

Thanks in advance!

Answer Source

From this article, it could be due to mod_rewrite module not being loaded in Apache.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download