I have a WordPress site that had a /blog directory that held another WP site. After moving that WP install to its own site and deleting that directory, I haven't been able to set up redirects for that missing folder.
What I would like is to redirect example.com/blog/article-1 to example.com/article-1
I used the following to redirect, but get a 404 error
RewriteEngine On
RedirectMatch 301 ^blog(/.*)?$ https://www.example.com/$1
I have tested this with ... ^blog1(/.*)?$...
and it worked as expected, but anything related to /blog it seems to ignore the.htaccess file.
There is no longer a directory there, so there shouldn't be any other.htaccess file that is taking precedence.
Any ideas as to why this isn't redirecting right?
If you can't beat them, join them. I ended up resolving this by creating the /blog directory that it was trying to look in and put in a new .htaccess file to redirect back to the root directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.