Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
    
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] –  sharif Apr 16 '12 at 9:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.