Rewriting URL of WordPress in a Subdirectory

I am renting some webspace and a domain from on which I run a WordPress site. Let’s call it WordPress is installed in the root folder.

As I can run multiple sites on this webspace, I installed a second WordPress site in a subdirectory:

I furthermore own a second domain – let’s call it – which is rented from I therefore created a .htaccess file which forwards all traffic from to

My problem: I can’t figure out how to rewrite the url to show “” once a user has reached that WordPress site. Right now, the url changes to “” after accessing the site via “”.

Many tutorials point out that a .htaccess file should be placed in the root directory of to rewrite the url. But as I already have a separate WordPress site sitting in that root directly, that doesn’t seem to work for me.

How can I therefore rewrite that url so that people who access the second WordPress site via keep seeing that url?

wp-admin redirects to subdirectory after moving installation to subdirectory

I have moved a wordpress installation to a subdirectory, from var/www/html to var/www/html/wp-blog mainly to make it future proof. I have followed the instructions in the codex. My server is configured as such

  1. I have a nginx reverse proxy which directs calls to to the port 8080.
  2. Apache listens on 8080
  3. I have modified the .htaccess from what is given in the codex and it is as follows


<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^$   RewriteCond %{REQUEST_URI} !^/wp-blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$   /wp-blog/$  1 RewriteCond %{HTTP_HOST} ^$   RewriteRule ^(/)?$   wp-blog/index.php [L]  </IfModule> 

I have only changed the ^(www.)? test to blog since I don’t want www. Also although the wordpress instance is in a subfolder I would like to server it via and the admin at

Now my trouble is that when I use the the url it takes me a the login page but I get stuck in a loop after that. I noticed that my url in the address bar has a redirect_to set at If I remove wp-blog from the redirect url, I am able to login.

The weird part is that, if the session gets over while I am in the admin page, the redirect url is fine!

At this point I have changed the WordPress URL in the General Settings to and everything works as far as I see. But as I said before I would like to use the admin panel on the root.