Search code examples
htmlwordpresshyperlinkhref

Wordpress changes URL?


I have an image which serves as an a href, the following a href doesn't work:

<div id="buttonNext">
    <a href="1-5/redrum-10">
        <img id="buttonNextImg" src="../../resources/img/buttonImg/next.png"/></a>
</div>

Me clicking on the link results in me being redirected to this website:

http://localhost/redrumwordpress/wordpress/redrum-10/

which also exists, but it doesn't link me to the correct website, the following code does work and links to the correct website:

<div id="buttonNextBottom">
    <a href="1-5/redrum-5/">
        <img id="buttonNextImgBottom" src="../../resources/img/buttonImg/next.png"/></a>
</div>

Which re-directs me to the correct page:

http://localhost/redrumwordpress/wordpress/1-5/redrum-4/

I've checked if I missed something like a / or ../ maybe it was in the wrong folder. I've checked for the file not being there, but it is and it isn't corrupt.

Could anyone help me with why WordPress won't link to the correct website, when I use this website outside of wordpress it works just fine.


Solution

  • Can't you use:

    <?php bloginfo('url'); ?> 
    

    Which will get your site address, then add the link path relative to this?