I am moving a website to WordPress, and using the Multiblog functionality. I’m not a htaccess expert by any means, but I do manage to use it regularly. So I’m reaching out here for some expert advice.
The website, www.blather.ie will use the same path for the sub-blogs as the old website. I need to keep legacy folders – like www.blather.ie/zeitgeist and some of the old content while publishing a WordPress blog to the same path. I realised when I tried to this that 403 error would occur. So I found a workaround here and here.
Adding lines to my htaccess as described in those pages to my exist file didn’t work. When I cleared out the htaccess file and started from scratch, I no longer got the 403 error – the content appeared, but without any themes/stylesheets. I checked the source, and saw that it was trying to pull the info from www.blather.ie/zeitgeist/wp-content… which doesn’t exist – it needs to pull it from www.blather.ie/wp-content/…
Also, this ‘fix’ also started creating loops in the Admin back end. Not sure why.
So, here’s my original htaccess file:
# BEGIN WordPress
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
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-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
Here’s the same htaccess with the recommended fix for the directory conflict problem, but which still causes the 403 error.
# BEGIN WordPress
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
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]
# Fix 403 errors on existing directories; WordPress overrides.
RewriteCond %{REQUEST_URI} ^/(zeitgeist)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress
Here’s a “clean” htaccess taken from the 1st recommended website – it cures the 403, but breaks paths, points to the wrong stylesheet location and causes redirect loops and 403s in the backend instead:
# 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]
# Fix 403 errors on existing directories; WordPress overrides.
RewriteCond %{REQUEST_URI} ^/(zeitgeist)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
So – my question – where am I going wrong with paths, and causing these damn feedback loops?
Thanks in advance!
Try this? Use the basic WP .htaccess, don’t get fancy at all and instead drop a tiny .htaccess in each legacy folder (these are dirs right?) that disables rewrite in the folder.
This method worked for me as I needed to provide access to legacy folders as well. There are some options you may need to hit with casual variations for environments. There are a few ways to do this such as disable rewrite, allow dir access, show details, etc so I can’t include a snippet for you at this juncture.