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.

Is is possible to configure WordPress permalinks directly in Apache httpd.conf?

I have a server situation (Apache 2.2.3 CentOS PHP5.1.6) where I can't use .htaccess for performance reasons, but can use httpd.conf.

The admin says that mod_rewrite is enabled, but AllowOverride is not, and I can't change those settings.

And I need to restrict the permalinks to just the "blog" directory.

This is what would go in .htaccess but needs to go into httpd.conf:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

Thanks...

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Put this within the container for your site.

<Directory /path/to/blog/>
  <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /blog/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /blog/index.php [L]
  </IfModule>
</Directory>
share|improve this answer
    
Works perfectly. Didn't know this was possible. Thanks! –  songdogtech Jun 7 '10 at 21:14
    
that's perfect. worked like a charm. quite different to the rewrite rules on Debian bases distros. Thanks. –  user80277 May 3 '11 at 20:16

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.