Archived topic
Header/Footer Plugin Question
5 replies · Started by Michael on February 12, 2020
Hi guys,
Please can you tell me if there is anything in this plugin that can't be achieved by using element hooks? it's been suggested I should install it by namecheap but I don't want to randomly add more plugins since I have already experienced weird behaviour in some cases. Thanks a lot for your help.
https://wordpress.org/plugins/header-footer/
Michael.
Hi there,
Sorry I'm not familiar with that plugin.
Hooks elements is pretty straight forward - it allows you to add whatever code you want into the hook specific.
If you have more specific questions then I can definitely let you know if it's achievable with hooks elements or not :)
Hi Leo,
The person at namecheap (domain name/host provider) suggested that I needed to insert code (included at the bottom of the post) into the header in order to workaround an inability to set a 301 redirect, and they told me that it was only achievable with that plugin. I don't believe it is. I also don't believe that the code they suggest is the right way to go either.
I tested url variations here to see where 301 redirects would need to be set up:
The only variation that seemingly needed one was https://www.reclaimdesign.org which throws a 200:
HTTP/2 200
date: Wed, 12 Feb 2020 18:59:58 GMT
content-type: text/html; charset=UTF-8
content-length: 89661
vary: Accept-Encoding
x-ua-compatible: IE=edge
link: ; rel="https://api.w.org/"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
cache-control: public
referrer-policy: strict-origin-when-cross-origin
x-cacheable: YES
age: 1356
x-cache: HIT
accept-ranges: bytes
They told me the only way to do this was to add this to the header using that plugin:
<script type="text/javascript">
if ( document.domain.substring(0,4).toLowerCase() == 'www.' ) {
window.location = document.URL.replace("//www.","//");
}
</script>
This does not seem like a solution at all, just stripping the www? Anyway, if you are able to give me any pointers or shed any light that would be much appreciated. I can't see the wood for the trees. Was having an online live chat to and fro with namecheap for some 5 hours yesterday and didn't really get anywhere, which is a bit demoralizing.
Thanks for your help.
Michael.
Hi there,
if you must use that code to get it to work then you can add it via a Hook Element and select the WP_Head hook.
Thanks David - I thought as much. Namescheap weren't having a bar of it though, so I thought I'd better check here. I appreciate the help.
You're welcome