I know that this is an ancient thread but I ran across it searching for the exact solution in March 2017. I hope this solution is the trial fix that works for someone and saves a little sanity. I posted it in the X Theme support forum since I had been asking for help there, and decided that it needed wider exposure.
The bizarre (to me) solution was to rearrange the two parts of my .htaccess. Here it is for anyone who similarly bangs their heads against their desks…
I need for my .htaccess to do two things; get people browsing Domain1.com to the WP instance in the web root of the site, and redirect users browsing Domain2.com to the WP instance in a subdirectory called SubdirectoryName herein. The code sections follow. The .htaccess file causing 301 errors for every page except Home had the redirect method BEFORE the WP method. I moved the WP method above the redirect method out of desperation after deactivating plugins, searching & replacing a lot of lingering development domain URLs with Better Search Replace plug-in, and even deactivating the .htaccess altogether (didn’t know how close I came with that one), and the and the site behaved normally, with Domain2.com redirecting as desired.
Moral of the story is that WP looks like a prima donna who demands to be recognized first.
Standard WP construct:
# 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
Redirect code to send Domain2.com to the WP instance in SubdirectoryName
# BEGIN redirect to SubdirectoryName
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?domain2.com$
RewriteCond %{REQUEST_URI} !^/SubDirectoryName/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /SubDirectoryName/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain2.com$
RewriteRule ^(/)?$ SubDirectoryName/index.php
RewriteBase /
RewriteRule ^index.(.*)?$ http://domain2.com/SubDirectoryName/ [r=301]
# END redirect to SubdirectoryName
Danged if I know what all of that redirect syntax means. We don’t have to learn every piece of code any longer and the WP ecosystem is alive and well. Glad to pay for X, support, and a few worthy plugins to reduce the incline of the learning curve. I just don’t have time – or desire – to fool with it these days. I designed my first site in Notepad, with a few buttons and a header built in Photoshop, in about 1994-5 to put my senior research paper online – just to see if I could. Then you HAD to know every dot and slash, but there were fewer of them, and it was more of a conquest thing. You could, as the book was entitled, “Learn HTML in 24 Hours”.
I hope this helps some frustrated soul get a few extra hours of sleep!