Reputation: 733
I am having a severe problem and have no clue about what is going on... I will specify the general issue which is causing multiple issues on this Wordpress powered portal.
Steps to reproduce:
Now, consider the case below:
I have tried several combinations with Permalinks, so it is not a problem with that. I even wrote my own Comment link generator in php with just a plain
href="#comments"
but still no luck...
If you need any further information about any function's code in theloop.php or anything please let me know.
Thanks in advance ! Regards
The contents of .htaccess are as below:
# 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
Upvotes: 0
Views: 215
Reputation: 5830
This is not a PHP issue, it is Javascript: it is evident when you reproduce it, and you can test it by disabling Javascript and adding #comments
at the end of the URL; it will work.
Now, I have done some work for you, and the culprit is a Javascript file aptly named hashchange.js
. Look, for example, at this line:
function second_passed() {
if(current_page!=location.href {
get_page_by_hash(location.href);
}
setTimeout(second_passed,1000);
}
Which explains why you see it “working” for a second.
And here is the redirect:
jQuery(window).hashchange(function() {
var link = window.location.hash.replace("#", "");
get_page_by_hash(link)
});
Note that hashchange
is a method for event handling available in jQuery Mobile.
Upvotes: 2
Reputation: 579
The way that page bookmarks are used is, as you know, the href="" of an anchor points to an #some-place. In order for this to happen #some-place must be the id of the element within the page you wish to go to.
For example:
http://gamersgeographic.com/monster-hunter-diary-1/#respond
should take you to the element with id="respond" in that page.
If the element with that ID doesn't exist you won't be able to travel to it, and may be the reason it results in a 404 Not Found. However, if the element does indeed exist on the page with the proper ID and it still redirects to a 404 then you may want to check your web server configuration to make sure it isn't filtering the # in some way.
Upvotes: 0
Reputation: 5183
<link rel="canonical" href="URL OF YOUR HOMEPAGE HERE>
add this in your header.php in <head></head>
section and then try . it shouldn't be giving 404 error !
Upvotes: 0