I'm moving my Wordpress blog from a subdomain (where it sits at the moment) to a sudrectory of my root domain. So basically it's now in
blog.exampledomain.com
And I want it to go to
exampledomain.com/blog
I can move all the content, but wp-admin throws 404 or redirects in the wrong way. So I'm not able to manage my blog!
The things I've done:
- In the DB: Changed siteurl to exampledomain.com
- In the DB: Change home to exampledomain.com/blog/
-
Updated the .htaccess as follows:
BEGIN WordPress
RewriteEngine On RewriteBase /blog/ RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
END WordPress
If I set it like this, the blog itself works but wp-admin throws 404. I also tried an alternative setup of .htaccess I've found around
#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog.
RewriteRule ^index\.php$ - [L]
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>
# END WordPress
This approach makes it so I'm redirected to
exampledomain.com/blog/blog/wp-admin
Which again throws 404! I'm stuck now
Additional info not sure if helpful:
- I have an haproxy sending the traffic from the main domain to the Wordpress instance (this is why the files are on the root directory of the WP but I want a subdir URL)
- I will change the static file URLs later from the wp-admin