How to display bad URL in 404 page?

General questions relating to Joomla! 3.x. Please consider the availability of third-party templates and extensions when deciding which Joomla version to use.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 111
Joined: Wed Feb 08, 2012 8:37 pm

How to display bad URL in 404 page?

Postby krishunt » Tue Mar 06, 2018 9:23 pm

I have created a custom 404 page that works, but I would like for it to display the bad URL that caused the 404 error in the first place. How would I do that?

User avatar
Joomla! Champion
Joomla! Champion
Posts: 5012
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: How to display bad URL in 404 page?

Postby sozzled » Tue Mar 06, 2018 9:35 pm

This is not really a Joomla question but you could try this:
  1. Edit your custom 404 page.
  2. Add this code to display the errant path in the message to the visitor:

    Code: Select all

    <?php echo "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']  ; ?>
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

Return to “General Questions/New to Joomla! 3.x”

Who is online

Users browsing this forum: gws and 21 guests