Home Moving WordPress to subdirectory url: wp-admin throws 404
Reply: 0

Moving WordPress to subdirectory url: wp-admin throws 404

LapsuS Published in 2017-11-13 20:57:45Z

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


And I want it to go to


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]

# END WordPress

This approach makes it so I'm redirected to


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
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.29734 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO