Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hey guys, My WordPress permalink structure is set to `/%postname%/.

When I create a page with a name "FAQs" the permalink generated is "mydomain.com/faqs".

When I link to this page in my code (hardcoded) like this...

<a href="<?php bloginfo('home'); ?>/faqs#b" title="FAQ's">FAQs</a> (pay attention to the #b hash at the end)

...wordpress somehow automatically notices that there is a page /faqs and replaces /faqs#b just with /faqs (without the hash).

Is there a chance I can write a kind of exception to my .htaccess file so WordPress doesn't do that?

Any idea how I could make that work?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

If your permalink structure is /%postname%/ with a trailing slash, you need to pass the hash like this: /faqs/#b with the trailing slash.

share|improve this answer
add comment

The URL hash (everything after the #) does not get sent to the server, so Apache or WordPress can't detect it.

WordPress redirects all URLs to the canonical version of the URL, to make sure everyone uses the same URL when linking to a post (which can help increase your ranking in search engines). This causes a redirect from /faqs to /faqs/. Browsers should append the #hash part to the redirected URL, but it seems IE does not do this.

You can prevent a redirect by using the canonical URL in the URL, like Milo suggested. So link to /faqs/#b and it should work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.