0

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...

1 Answer 1

4

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>
2
  • Works perfectly. Didn't know this was possible. Thanks! Jun 7, 2010 at 21:14
  • that's perfect. worked like a charm. quite different to the rewrite rules on Debian bases distros. Thanks.
    – user80277
    May 3, 2011 at 20:16

You must log in to answer this question.

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