4

in my apache config i have following settings

<Directory "/opt/website/new-website-old/httpdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Location /server-status>
    #AllowOverride None
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from all
</Location>

Using this the server-status works, but if i change the allowoverride option to all it doesn't. How can i get the server status to work if allowoverride option is set to All

I have followed this but still no luck wordpress server status

In my current ht access file i have

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www.asb.com.au$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/about/the-group/domain-asb$1 [R=301,L]
</IfModule>

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

# END WordPress

2 Answers 2

10

Firstly, I am confused by your use of the following in the location block, I feel like you would probably want to deny from all, but allow from perhaps your own IP, but I digress.

Deny from all
Allow from all

The most important thing you missed from the guide you posted was the following line:

RewriteCond %{REQUEST_URI} !=/server-status

Which would make the .htaccess file look more like this:

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

On top of that, you seem to have two separate blocks of rewrites in your .htaccess which are nearly identical, I would combine them into one, to make the finalized contents of .htaccess be (and nothing else):

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !=/server-status
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www.asb.com.au$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/about/the-group/domain-asb$1 [R=301,L]
</IfModule>

Just a bit more info for you, the AllowOverride being set to none is making apache totally ignore the .htaccess file, so when it is set to all, clearly that tells you something in .htaccess is overriding the ability for /server-status to be handled by the sever-status handler. In your .htaccess file the offending line is basically:

RewriteRule . /index.php [L]

Which is telling apache to rewrite everything and send it to index.php, this is because wordpress processes everything through index.php and allows for SEO urls, among other things.

The line we added:

RewriteCond %{REQUEST_URI} !=/server-status

Tells apache to do what we stated above (rewrite everything to index.php based on the RewriteRule), unless the URI is /server-status - since that will no longer be rewritten and sent to wordpress index.php, the handler should be able to behave as expected.

The other two conditions

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

For your knowledge, tell apache not to rewrite the url if the request is an actual file, or an actual folder.

You can read more about Mod_Rewrite in the official documentation.

1
  • i have made the changes and it now works. But there is one line which is unclear to me as to why it does not work. If i uncomment it the server-status does not work. if i comment it out it does. #RewriteRule ^index\.php$ - [L]
    – shorif2000
    Apr 16, 2012 at 9:19
3

The simplest way to get the server-status page working with the Wordpress rewrite rules is to just create a folder or file in the Wordpress folder with the name server-status

This works because (as WerkkreW points out) the rules:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

mean that rewriting should not be done if there is a file or directory with the same name.

You must log in to answer this question.

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