WP in subfolder. Redirected to non-existent page when visiting said folder
-
Hello all!
I’ve just encountered a bizarre situation. My WP is in the subfolder /blog of my root directory. Everything works perfectly fine, except that when I visit the url mydomain.com/blog/, it gets 404’d, which is expected I guess? But it also gets redirected to mydomain.com/2011/03/25/blog-2/. There is no such page or post, nor have I ever created one, though I don’t remember the link behaving like this before. Any thoughts? I can simply redirect /blog to the root directory through the .htaccess, but I’m more puzzled by the cause.
here’s my .htaccess if needed:
# 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 <Files wp-config.php> order allow,deny deny from all </Files> Options -Indexes
The wp-config was moved to the root directory for security purposes, so that’s fine.
Cheers.
-
Hello again. I tried out a few possible solutions but nothing worked. Also I realised my previous explanation sounded confused and confusing and needed some clarifying:
My WP address is at – mydomain.com/blog/
and I set my site address to – mydomain.com
I have other subdirectories under the root such as
mydomain.com/media/ and
mydomain.com/misc/
but I disabled directory listing in my .htaccess so these subdirectories return a 404. And they work fine. But when I enter
mydomain.com/blog/
instead of being redirected to mydomain.com/ or getting a 404 for mydomain.com/blog/ I get redirected and get a 404 at
mydomain.com/2011/03/25/blog-2/The thing is there’s no such post at this date. And it only just turned up recently. So I found it rather bizarre…
I hope that makes things abit clearer! Cheers 😀
Hello again. I’ve resolved the issue. Turns out that day I created a page named ‘blog’ and deleted it shortly after, but the entry wasn’t wiped from the wp_posts table so mydomain.com/blog/ kept redirecting to that ghost page. I solved it simply by deleting that entry. Hope that helps anyone with similar issues!
Oops, very very sorry, that was a mistake. The “ghost page” I referred to turned out to be a custom menu item, which happened to be called “blog”. I noticed my menu was missing something just after I updated this thread. So I guess custom menu items are treated as posts? Really? And the takeaway then is to not name menu items after a directory I suppose…that was unexpected.
- The topic ‘WP in subfolder. Redirected to non-existent page when visiting said folder’ is closed to new replies.