Wednesday, April 22, 2015

mod_rewrite woes...

I'm having a problem with WordPress that is preventing my advance on another website. In short, I can't get "Permalinks" to work in any but the "Default" mode. Any other choice results in the same form:
http://localhost/nptbeyond/test/
which results in the dreaded 404 error.

Permalinks are features of WordPress that let you choose the format of the links in the pages that you post. You can choose among Day and Name, Month and Name, Numeric, or Post name. Each of these should provide a different format. But choosing any of these renders the same result: Post name in the form above.

Use of any but Default requires:


Installation and activation of Module rewrite (mod_rewrite) in the server.
Our server is /etc/apache2 version 2.4 and is up to date.
We have searched for the module and found it as /usr/lib64/apache2/mod_rewrite.so

It also exists in the Apache Server Module list with the Status of Enabled.
We have tested it with http://tinyurl.com/k99pzfe and its http://www.wallpaperama.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html. The latter says it is not being used, despite being Enabled.
So how else to tell the server to use it other than enabling it?

Various other settings in /etc/apache2/httpd.conf, other subordinate .conf files, and the .htaccess files in the various server directories. In particular, we need:
+ A directory section in httpd.conf referring to the entire server path

Options FollowSymLinks
AllowOverride All
Require all
granted


+ In WordPress's home directory, the FollowSymLinks option enabled.
Done, in the section of httpd.conf as well as in the local .htaccess above the WordPress section.

Checking the logs:
/var/log/apache2/error_log
Explicitly set LogLevel alert rewrite:trace3 to enable logging rewrite events.

cat error_log|grep 'rewrite' returns no recent rewrite issues.

But there is an implication that FollowSymLinks and SymLinksIfOwnerMatch must both be on. We had the former already, add the latter and restarted the server: No change.

I found another string to follow, perhaps tomorrow:
http://www.askapache.com/htaccess/crazy-advanced-mod_rewrite-tutorial.html

It's nice to know I am not alone.

No comments: