I built a website for a client at clientsite.com. She has a new business and wants a wordpress site. So I installed wordpress in clientsite.com/wordpress. I can't install wordpress in the root because that's where her original site is and I need the wordpress site in its own folder. She has a domain with godaddy called newbusiness.com. I assigned that to bluehost (her host provider) and added it as an addon and now when you go to newbusiness.com you see the pages located at clientsite.com/wordpress, and newbusiness.com in the address bar. Exactly what I want. EXCEPT, when you navigate to any other page on the site, the address bar changes back to clientsite.com/wordpress. Not good.
I'm having a HORRIBLE time trying to figure out how to keep newbusiness.com in the address bar throughout the whole site. Please help!
One really simple solution is to add a few lines to the .htaccess file in your /wordpress folder. This file is created during the installation, so it should be there. It probably contains the following:
# 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
Try adding these 3 lines:
RewriteCond %{HTTP_HOST} !newbusiness.com$ [NC]
RewriteCond %{REQUEST_URI} clientsite\.com/wordpress [NC]
RewriteRule ^(.*)clientsite\.com/wordpress(.*)$ $1newbusiness.com$2 [L,R=301]
right before </IfModule>
来源:https://stackoverflow.com/questions/17076890/mask-a-forwarded-url-to-wordpress-in-a-directory