Help with configuring network rewrites using httpd.conf instead of .htaccess
-
I’m setting up a test WordPress server on my local machine (which is running stock Apache, MySQL, and PHP). I started completely from scratch with a new directory, new database, and new virtual host. The WordPress installation went smoothly, pretty links work fine, and I was able to set up my network using subdirectories.
However, I’ve run into some problems with redirects that stem from one our IT mandates. Our IT department requires that we don’t allow .htaccess files anywhere on the server. All configuration changes must be done in the httpd.conf file by IT.
Currently in my httpd.conf file, I have these blocks:
#WordPress sites <Directory ~ "c:/Sites/wp_[0-9a-zA-Z-_]+"> # 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 </Directory> #WordPress network sites <Directory ~ "c:/Sites/wpn_[^/]+/"> <IFModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [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-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] </IfModule> </Directory>
However when I try to go to a dashboard for one of the network’s sub-sites I get stuck in a circular redirect. (https://network-test.localhost.me/arts/wp-admin redirects to https://network-test.localhost.me/arts/wp-admin )
So here’s the head scratcher – If I change the above block to allow .htaccess and then put the mod_rewrite options into a .htaccess file, everything works fine. I just can’t do that because my IT department has disallowed the practice.
I’m self-taught in Apache and there are a ton of things I don’t fully grasp, so does anybody know why these settings would work in .htaccess but wouldn’t work in httpd.conf?
- The topic ‘Help with configuring network rewrites using httpd.conf instead of .htaccess’ is closed to new replies.