homepage Welcome to WebmasterWorld Guest from 54.227.215.140
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Wordpress "Pretty Links" fail to load
Setting up Apache to work with Wordpress routing
jasontheadams



 
Msg#: 4649469 posted 7:18 pm on Feb 26, 2014 (gmt 0)

Greetings!

Important details: Running Apache 2.4.6 on Ubuntu 12.04. The rewrite module is enabled.

I'm having an issue on my local machine where when I switch the permalinks in Wordpress to "Pretty Links" (i.e. url routing). The links no longer work -- I get a "Not Found on this server" page. For those unfamiliar, Wordpress generates an .htaccess in the wordpress root with the following:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /example/wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /example/wordpress/index.php [L]
</IfModule>

# END WordPress


I'm currently just accessing the site via localhost/example/wordpress, which is affected by the following in the apache2.conf:

<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>


And the following in the 000-default.conf:

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory /var/www>
AllowOverride all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


As far as I can tell, that's everything involved. I added the AllowOverride All to the 000-default.conf. Please let me know if I'm missing something or how I can go about troubleshooting this.

Thanks!

 

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4649469 posted 9:19 pm on Feb 26, 2014 (gmt 0)

welcome to WebmasterWorld, jasontheadams!


you might get some clues in your server error log file.
if that doesn't help - since you have access to the server config file, you might try temporarily turning on mod_rewrite logging to see exactly how your script is called.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#logging
The log level can be set specifically for mod_rewrite using the LogLevel directive

jasontheadams



 
Msg#: 4649469 posted 9:57 pm on Feb 26, 2014 (gmt 0)

Thanks, phranque!

I'm not seeing anything in the server error log. I set "LogLevel alert rewrite:trace3" and still nothing displayed in my log.

I suppose this suggests that it's not even attempting to rewrite?

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4649469 posted 10:26 pm on Feb 26, 2014 (gmt 0)

did you put the LogLevel directive in an appropriate context (like VirtualHost?)

try a higher trace level and see if it's still not logging anything.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4649469 posted 5:10 am on Feb 27, 2014 (gmt 0)

The links no longer work -- I get a "Not Found on this server" page.

Does that mean that the WordPress code isn't executing at all? The essence of a CMS-- here WordPress-- is "if the file doesn't physically exist, hand off to the CMS". That means a 404 simply shouldn't occur. That is, the visitor can receive a 404, but the server will never send one out. Do your ordinary access logs show a slew of 404s?

jasontheadams



 
Msg#: 4649469 posted 3:10 pm on Feb 27, 2014 (gmt 0)

I figured it out!

There was absolutely nothing wrong with my configuration.. it was how I was restarting Apache. Oops!

There's a serious difference between 'service apache2 restart' and 'sudo etc/init.d/apache2 restart'. Apparently only the latter actually prompts apache to re-cache the config files!

Thanks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved