WordPress without Apache Dir

A simple htaccess to run Apache without the dir module. Specific versions of Apache 2.4.x contained issues when using the dir module with some htaccess rules. However, this didn’t resolve all issues I was having with Apache 2.4 and WordPress. Multisite WordPress support may not be fully supported with this example.

# BEGIN WordPress
RewriteEngine On
RewriteBase /

RewriteRule ^$ index.php [L]
RewriteRule ^(.+)/wp-admin/([^/]+/)?$ $1/wp-admin/$2index.php [L]
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(admin|includes).*) wp/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
RewriteRule . index.php [L]
# END WordPress

Comments Off on WordPress without Apache Dir

Categories random