Welcome to TalkGraphics.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2018
    Location
    Barnes, London
    Posts
    953

    Default 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    One for the coding wizards amongst you!

    Where I have a 404 page (e.g. https://hypnosis-retreat.co.uk) and type https://hypnosis-retreat.co.uk/bhabha, a 404 page is correctly rendered as expected, but where I extend the path e.g. https://hypnosis-retreat.co.uk/bhabha/morebha it fails to render the page (a problem with relative URLs as I now understand).

    I added a Base Tag into the 404 page
    Code:
     <base href= "https://hypnosis-retreat.co.uk/" target="_blank">
    but then the page attempts to render both variants at the same time.

    Whilst this is an unlikely scenario and I doubt a sane person would embark on doing it, is there a fix for this issue.

    FYI: if you type in http://www.bbc.co.uk/bhabha/morebha it correctly shows the 404 page.

    Thoughts and solutions welcome

    Thanks,

    Gary

  2. #2
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,932

    Default Re: 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    It appears that going into a sub directory looses access to the 404_htm_files Gary, which is probably what your saying.
    I'd suggest keeping the 404 to a single variant.
    I've tried loading images from within an iframe which works fairly well.
    HOME redirect can just be a text link.
    I'm having some success and I'll post an example as soon as I finalise the page.
    Egg

    Minis Forum UM780XTX AMD Ryzen7 7840HS with AMD Radeon 780M Graphics + 32 GB Ram + MSI Optix Mag321 Curv monitor
    + 1Tb SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  3. #3
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,878

    Default Re: 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    Gary, have you tried removing the target from <base href= "https://hypnosis-retreat.co.uk/" target="_blank"> to just have <base href= "https://hypnosis-retreat.co.uk/">?

    Have you added "ErrorDocument 404 https://hypnosis-retreat.co.uk/404.htm" to your .htaccess file?

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #4
    Join Date
    Apr 2018
    Location
    Barnes, London
    Posts
    953

    Default Re: 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    Thanks Acorn, excellent as always!

    I needed the full URL string in the .htaccess file, not just the file /404.htm. I removed target from the base ref too.

    Thanks for looking Egg. I wanted to keep the 404 file in the same directory for ease. I can then use a revisit the menu option more easily.

    https://hypnosis-retreat.co.uk/bhabha/morebha.

    Many thanks to you both,

    Gary

  5. #5
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,878

    Default Re: 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    Quote Originally Posted by Initiostar View Post
    Thanks Acorn, excellent as always!
    I needed the full URL string in the .htaccess file, not just the file /404.htm. I removed target from the base ref too.
    Thanks for looking Egg. I wanted to keep the 404 file in the same directory for ease. I can then use a revisit the menu option more easily.
    https://hypnosis-retreat.co.uk/bhabha/morebha.
    Many thanks to you both,
    Gary
    Gary, Good to hear.

    I removed the blue box and change the text colour to the darker blue and dropped the graphic into the waves.
    It was more dramatic, making me want to error in just to see it again.

    A touch of pedantry, "Sandi Goss Life Coach, Clinical Hypnotherapist D.Hyp & Vegan Practitioner" needs a colon or hyphen after the Surname as it is a list.

    It was also nice to see one of my cousins helping on the front page:

    Click image for larger version. 

Name:	65187@2x.jpg 
Views:	51 
Size:	91.6 KB 
ID:	126800
    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  6. #6
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,932

    Default Re: 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    Thanks as always Acorn. I tried the full site pathname in my .htaccess file earlier and it didn't give a 404.htm file at all. As always probably mistyped the url again. Got it working now
    Egg

    Minis Forum UM780XTX AMD Ryzen7 7840HS with AMD Radeon 780M Graphics + 32 GB Ram + MSI Optix Mag321 Curv monitor
    + 1Tb SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  7. #7
    Join Date
    Apr 2018
    Location
    Barnes, London
    Posts
    953

    Default Re: 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    Thank you Acorn for the suggestions: https://hypnosis-retreat.co.uk/404.htm. I might need to straighten up my 404 man so he sits in the waves a bit better! Another day.

    It was also nice to see one of my cousins helping on the front page:
    Your cousin is doing an amazing job in the real world, especially right now in helping people for whom this is not a great time

    Win-Win all around. Egg, glad you've got yours working too.

    Gary

  8. #8
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,878

    Default Re: 404 Redirect Problem - Relative Paths Unresolved (even with an HTML Base Tag)

    Quote Originally Posted by Initiostar View Post
    Thank you Acorn for the suggestions: https://hypnosis-retreat.co.uk/404.htm. I might need to straighten up my 404 man so he sits in the waves a bit better! Another day.
    More John Cleese in Monty Python.
    It's...

    Click image for larger version. 

Name:	MontyPythonCleese_2738935b.jpg 
Views:	46 
Size:	81.1 KB 
ID:	126801

    Source: https://www.telegraph.co.uk/culture/...of-comedy.html

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •