The Joomla! Forum ™



Forum rules


Forum Rules
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 49 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Mar 02, 2008 11:54 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jul 31, 2007 10:06 am
Posts: 5
I get the below 404 error message when trying to access registered content (when logged out)

Code:
403 - You are not authorised to view this resource.
You may not be able to visit this page because of:

an out-of-date bookmark/favourite
a search engine that has an out-of-date listing for this site
a mistyped address
you have no access to this page
The requested resource was not found.
An error has occurred while processing your request.
Please try one of the following pages:

Home Page
If difficulties persist, please contact the System Administrator of this site.


http://www.ghobbs.eu/index.php?option=c ... d&Itemid=6

Surely users should be redirected to a friendly logon page when they try and access content that's registered? I've searched the forum and there are plenty of reports of this issue but no solutions.

I have tried all variations of SEO Settings with no success. In desperate need of help.


Top
 Profile  
 
PostPosted: Thu Mar 20, 2008 6:35 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Mar 04, 2008 10:49 pm
Posts: 11
I'm glad I'm not the only one having this problem...

If unregistered users try to access Registered content, it should take them to a login page at the very least! This ugly error message screen is very discouraging.

Is there any way to change this? A Plug In or configuration setting - SOMETHING?!!


Thanks.


Top
 Profile  
 
PostPosted: Wed Mar 26, 2008 11:35 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 18, 2007 8:50 am
Posts: 45
I ALSO HAVE THIS PROBLEM!!!!!

It is Joomla! It must be, Ive done so much testing, It even does this with just bare joomla 1.5.2

This is ssooo bad for me because so many people link my site around on forums, sites & etc...

now when people go to those links, it goes to a 404 page, not a "you need to register page"

so bad for me :( Ill lose so many new possible users


Top
 Profile  
 
PostPosted: Fri Mar 28, 2008 11:53 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Mar 12, 2008 10:12 pm
Posts: 2
I've tried every module / plugin / component for SEF/SEO like sh404sf, smarty (latest version conflicts with other plugins it appears), etc.

sh404sf is probably the best alternative, however having to put the system into legacy, and having it break page-breaks by default is annoying. You get to have a 404 error page, but isn't compatible with chronoForms, 4.6.2 of phoca, and some custom plugins.

It would be great if there was an option to select from a drop down list an article to act as the error 404 page.
Actually, it's mandatory. Why isn't there one? It's more needed than having friendly URL's. Why??

I came from Drupal for the wine and beer, and all I see so far are empty glasses and kegs. Where did all the fun go? Better yet, wasn't a 404 custom page possible in Mambo? :eek:

Cheers
:pop :geek:


Top
 Profile  
 
PostPosted: Mon Mar 31, 2008 3:47 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Feb 19, 2008 7:25 pm
Posts: 29
We also have this problems on our site.

The problem didn't start until we had a different domain point to the Joomla! folder and started to use that one.
Here is the site http://tserverhq.com

We need to have our customers register to use our products the sooner this gets fixed or a problems is posted the better. Thank you.


Top
 Profile  
 
PostPosted: Tue Apr 01, 2008 9:47 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Mar 29, 2008 11:11 am
Posts: 3
I have the same problem, however in 1.0.x there was an article which prompted the users to login


Top
 Profile  
 
PostPosted: Thu Apr 03, 2008 12:05 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Apr 03, 2008 11:58 am
Posts: 1
I am quite new to Joomla and this is a hack more than a solution but it works for me..
You should have an error.php document in your template foder where the custom error page is defined.
All you need to do is add a small piece of code in the head section of this document:

Code:
<script language="javascript" type="text/javascript">
//<![CDATA[   
<?php if($this->error->code == '403'){ ?>
   window.location = "http://www.yoursite.com/"
<?php } ?>
//]]>
</script>


Obviously change yoursite.com appropriately..
Hope this offers some sort of solution to those of you who are stuck


Top
 Profile  
 
PostPosted: Thu Apr 03, 2008 1:08 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jan 26, 2007 4:55 pm
Posts: 14
goangus wrote:
I am quite new to Joomla and this is a hack more than a solution but it works for me..
You should have an error.php document in your template foder where the custom error page is defined.
All you need to do is add a small piece of code in the head section of this document:

Code:
<script language="javascript" type="text/javascript">
//<![CDATA[   
<?php if($this->error->code == '403'){ ?>
   window.location = "http://www.yoursite.com/"
<?php } ?>
//]]>
</script>


Obviously change yoursite.com appropriately..
Hope this offers some sort of solution to those of you who are stuck


Good! It works! But someone have a code joomla hack?


Top
 Profile  
 
PostPosted: Mon Apr 14, 2008 3:33 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Apr 14, 2008 2:28 pm
Posts: 4
Hi all:

Has anybody found the right solution?

I´ve the same problem, no way to get rid of 404 error.

Thanks in advance and sorry about my english.


Top
 Profile  
 
PostPosted: Sat May 24, 2008 9:26 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
Little surprise (and disappointed) that the developers do not care about this issue.
First, I think I do wrong in configuration/setting, but after searching forum, I have not see a right solution from developers.

Quote:
someone have a code joomla hack?

you can check my patch for Joomla 1.5.3 (use at your own risk)
http://www.mediafire.com/?zh25moumbzz

I add a funtion into JFactory: if user logged in, the error page will apprear, if not, redirect to login.
And change a bit in components\com_content\models\article.php, category.php, section.php to point to this function.


Last edited by Replika on Wed May 28, 2008 3:54 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue May 27, 2008 12:15 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Jan 05, 2008 10:23 pm
Posts: 36
Location: Cambridge, MA
Replika - Am I correct in assuming the following is true: Your solution does not redirect the user to the original content item they were attempting to access? I thinK I will modify the patch to do this. I want to start with your latest version so let me know if you have updates. Thx.


Top
 Profile  
 
PostPosted: Tue May 27, 2008 1:18 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Apr 14, 2006 4:06 pm
Posts: 18
shahpound wrote:
Replika - Am I correct in assuming the following is true: Your solution does not redirect the user to the original content item they were attempting to access? I thinK I will modify the patch to do this. I want to start with your latest version so let me know if you have updates. Thx.

If a guest go to a registered article, my patch will let him to login page. And after login successfully, it will direct to that article (your original content)


Top
 Profile  
 
PostPosted: Tue May 27, 2008 5:35 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue May 27, 2008 4:25 pm
Posts: 1
Hi, I have the same problem, and I'm very surprised that it hasn't been fixed, I'll try Replika's hack....

Another "problem" I've found related to this one is that I can't show links to restricted content to unlogged users.... so when they clic one of them it takes them to the login page... this doesn't look that complicated, is it?


Top
 Profile  
 
PostPosted: Sun Jun 01, 2008 7:44 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Jun 01, 2008 7:37 am
Posts: 1
Morning!

I tried the fix from Replika. At first it was not working, but figured it out when looking at the code. I started off with an article for which access level was set to registered. Code however works on the event an article is public but its section and/or category are set to registered. Tried it again and then the fix worked.

Thanks Replika!


Cynthia


Top
 Profile  
 
PostPosted: Wed Jul 16, 2008 7:20 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Jul 15, 2008 6:29 pm
Posts: 1
Thanks for the fix Replika!
Anyway, to fix the last issue: Registered only articles.
It was fixed by replacing the following code in the file components/com_content/views/article/view.html.php:

Replace:
Code:
return JError::raiseError( 404, JText::sprintf( 'Article # not found', $id ) );


With:

Code:
               if($id!=0){
                                 JFactory::loginRequest();  //Viet
                        }else{
                                return JError::raiseError( 404, JText::sprintf( 'Article # not found', $id ) );
                        }


And of course apply the patch that Replika provided.

Thanks, and hope this can save you some time.


Top
 Profile  
 
PostPosted: Tue Jul 29, 2008 12:14 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 18, 2007 8:50 am
Posts: 45
Using Joomla 1.5.4

HAVE HAD THE EXACT PROBLEM I HAVE TRIED EVERYTHING!!!!

At least I feel better I am not the only one- I thought I totally messed something up somewhere


Top
 Profile  
 
PostPosted: Sat Aug 23, 2008 12:05 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 03, 2006 2:41 am
Posts: 11
Location: Prescott, Arizona
Same problem. 404 error when registered content is accessed by a "guest".
Running Joomla 1.5.6

ADMINISTRATORS......DEVELOPERS......WHERE ARE YOU ON THIS???

Can someone official at least weigh in on it?? Acknowledge that there is a problem?

Thank you.


Top
 Profile  
 
PostPosted: Wed Aug 27, 2008 11:04 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jul 21, 2008 4:12 pm
Posts: 5
Just so people are aware the issue is occurring for me ass well and hopefully my setup helps show it isn't a server configuration issue.

I have a primary Joomla site located at http://www.sitename.com/ at 1.5.6 and I have a Joomla site created at http://www.sitename.com/submenu which is 1.5.2, the site located in the submenu folder does not have the issue with the 404 page showing when trying to access registered content and you are not logged in but the primary site in the root folder does have the issue.


Top
 Profile  
 
PostPosted: Wed Aug 27, 2008 11:27 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jul 21, 2008 4:12 pm
Posts: 5
I got more information for everyone.

I have found that you don't get the 404 if you set both the menu item to "registered" and the article to "registered", but of course if you do that no one sees the link until they log in. But if you manually go to the link in the address bar you are prompted to log in.

Example:
http://www.sitename.com/index.php?optio ... 4&Itemid=2

It seems like Joomla doesn't know how to handle the request if only one of the items is set to "registered" so hopefully this helps with the next patch.

This would explain why I have the issue on the sub site and not the root because I was just cutting and pasting the link to the item on the sub site not actually go through a menu item.


Top
 Profile  
 
PostPosted: Thu Aug 28, 2008 9:15 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jan 22, 2006 11:21 pm
Posts: 17
Location: Annapolis, MD
Add me to the list of complainers...

I can confirm that the issue is due to different permission levels on menu items and pages linked to by them.

I've been able to get around the issue by setting the menu items to the same permission level as the pages. BUT, as has been stated before, this ends up hiding the links from the visitors.

So, this is a BUG.

I'm not sure if this is related, but I can't seem to create a custom page link to the login form component. I create the menu item, associated it with the login component, assign module positions to it, but all I seem to get is a plain login page. What gives?

I can't believe how much time I've wasted trying to resolve this stupid issue... I still love Joomla, though.


Top
 Profile  
 
PostPosted: Sun Sep 07, 2008 12:26 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Aug 09, 2008 4:21 pm
Posts: 11
I'm experiencing the same problem. I tried the php fix that replika recommended, but it didn't work. To be fair I probably did something wrong since I know exactly zero php. Hope someone can post an easier fix and one that doesn't require php coding.


Top
 Profile  
 
PostPosted: Mon Sep 08, 2008 8:45 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 7846
Location: New York
It's not really a bug but actually this is a really complicated issue that has been addressed in part by some patches that are in the current SVN and some that are pending in the tracker.

Search for 404 (sorry can't link joomlacode is so slow today)

_________________
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.


Top
 Profile  
 
PostPosted: Mon Sep 08, 2008 11:02 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jan 22, 2006 11:21 pm
Posts: 17
Location: Annapolis, MD
The following code contains a modification I made to the loadArticle function in J1.5.6 from article.php:

(joomla_root)/components/com_content/models/article.php
-->beginning at line 556 (assuming no other hacks)

IMPORTANT: The code modifications below are aimed at users of JACLplus pro because of the the reference to JACL subgroups. ALSO, you must implement SEF urls so that the url redirection can be properly created.

The key to the functionality of this hack is the function JURI::getInstance. Used in conjunction with base64 encoding, I assembled a method for capturing the current url request, encoding it, and returning in the form:

http://www.yoursite.com/Log-in.html?ret ... TERSGOHERE

This creates a redirect to the login page which, most importantly, redirects you to the originally requested page, assuming your login credentials provide suffecient access rights.

Remember, this is just a temporary hack, though it does work quite well.

Code:
   /**
    * Method to load content article data
    *
    * @access   private
    * @return   boolean   True on success
    * @since   1.5
    */
   function _loadArticle()
   {
      global $mainframe;

      if($this->_id == '0')
      {
         return false;
      }

      // Load the content if it doesn't already exist
      if (empty($this->_article))
      {
         // Get the page/component configuration
         $params = &$mainframe->getParams();

         // If voting is turned on, get voting data as well for the article
         $voting   = ContentHelperQuery::buildVotingQuery($params);

         // Get the WHERE clause
         $where   = $this->_buildContentWhere();

         $query = 'SELECT a.*, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' .
               ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
               ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug,'.
               ' g.name AS groups, s.published AS sec_pub, cc.published AS cat_pub, s.access AS sec_access, cc.access AS cat_access '.$voting['select'].
               ' FROM #__content AS a' .
               ' LEFT JOIN #__categories AS cc ON cc.id = a.catid' .
               ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = "content"' .
               ' LEFT JOIN #__users AS u ON u.id = a.created_by' .
               ' LEFT JOIN #__groups AS g ON a.access = g.id'.
               $voting['join'].
               $where;
         $this->_db->setQuery($query);
         $this->_article = $this->_db->loadObject();

//         if ( ! $this->_article ) {
//         return false;
//         }
      //Modification to resolve 404 redirect error from registered page
      //Prevent from throwing 404 and redirect to any desired page e.g. login/register or content page
         if ( ! $this->_article ) {
         //Retrieve content access level
         $user =& JFactory::getUser();         
         $myquery = "SELECT `access` FROM #__content WHERE `id`=". (int) $this->_id;
         $this->_db->setQuery($myquery);
         $myrow = $this->_db->loadObject();
                                                                 //Retrieve JACLplus access levels
             defined('_JACL');
             $user = &JFactory::getUser();
             $gids = $user->get( 'jaclplus', '0' );
             $myJACLGids = explode(",", trim($gids));
         
         if (in_array($myrow->access , $myJACLGids)) {
         return true;
         } else {
         //Here we retrieve the url instance, encode it, and assemble
                                                //the url for the login page with the redirect appended to it.
         $uri =& JURI::getInstance();
         $url = $uri->getPath();
         $url = base64_encode($url);
         $mainframe->redirect("Log-in.html?return=".$url);
         exit();
         }
         }
      //End Modification to resolve 404 redirct error from registered page


         if($this->_article->publish_down == $this->_db->getNullDate()) {
            $this->_article->publish_down = JText::_('Never');
         }

         // These attributes need to be defined in order for the voting plugin to work
         if ( count($voting) && ! isset($this->_article->rating_count) ) {
            $this->_article->rating_count   = 0;
            $this->_article->rating         = 0;
         }

         return true;
      }
      return true;
   }


Top
 Profile  
 
PostPosted: Tue Sep 09, 2008 9:41 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 09, 2006 11:38 pm
Posts: 30
Location: Netherlands
Here's my solution for custom error messages:

  • Create for each error message an article (aka content item). Preferably it should contain images with text on it so they won't show up with their content when a user does a search (thanks Amy for pointing this out).
    I named the pages after the error numbers and the message that Joomla shows.
  • Create a menu (called hidden menu or something like that) and create a module for it, but do NOT publish it.
  • Add for each article containing the error message a link on this hidden menu, name them 403 or 404, etc.
  • Copy error.php from the /templates/system directory to your template directory
  • Edit this error.php and add just before the head tag the following:
    Code:
    <?php
    $errormessages= array (403, 404);
    if (in_array($this->error->code, $errormessages)) {
        echo "<meta http-equiv=\"refresh\" content=\"0;URL=/" . $this->error->code . "\" />";
    }
    ?>

    Note: in the code above, add your menu link names in the array of error messages.

Now, what this does is show the regular error message and then immediately refresh the page and show your customized error message. It shows the proper error messages for the search engines (you can check it here, yet displays your visitor with a decent page.

Maybe it's not the most beautiful solution, but it's simple, easy and it works. :D


Here's an alternative (adapted from guywithcable's solution for a custom 404)
after "defined( '_JEXEC' ) or die( 'Restricted access' );" add
Code:
 $errormessages = array (403, 404);
   if (in_array($this->error->code, $errormessages)) {
      echo file_get_contents("http://www.yourwebsite.com/". $this->error->code);
   }   
   
    else
    {

And at the bottom, after "</html>" add
Code:
<?php
    }
    ?>


Top
 Profile  
 
PostPosted: Wed Sep 10, 2008 3:31 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Oct 18, 2007 8:50 am
Posts: 45
1.5.7 is out, that has been fixed :D


Top
 Profile  
 
PostPosted: Wed Sep 10, 2008 7:56 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 09, 2006 11:38 pm
Posts: 30
Location: Netherlands
Well, it was a nice excercise.... :laugh:


Top
 Profile  
 
PostPosted: Thu Sep 11, 2008 12:51 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jan 22, 2006 11:21 pm
Posts: 17
Location: Annapolis, MD
...hmm

I tested with J1.5.7 and I am still experiencing the same problem - no redirection to login page (with encoded url that leads back to originally requested page).


Top
 Profile  
 
PostPosted: Sat Sep 13, 2008 10:07 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Thu Aug 18, 2005 12:22 pm
Posts: 960
Location: Ballarat, Australia
Hmmm I figured I could modify the error.php page however I like

One example I've done is here

That file is templates/system/error.php

This site doesn't have registration but you could still modify that page however you like.

May be even put a php auto redirect to your customised login/rego page if you want.

_________________
We cannot become what we need to be ... by remaining what we are


Top
 Profile  
 
PostPosted: Sat Sep 13, 2008 11:29 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 09, 2006 11:38 pm
Posts: 30
Location: Netherlands
Redirecting a page doesn't return the right error code for a/o search engines ;)


Top
 Profile  
 
PostPosted: Sat Sep 13, 2008 3:33 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 7846
Location: New York
Yup, that's the next, much more complicated phase of this.

Suggestions welcome for sure.

_________________
So we must fix our vision not merely on the negative expulsion of war, but upon the positive affirmation of peace. MLK 1964.
http://officialjoomlabook.com Get it at http://www.joomla.org/joomla-press-official-books.html Buy a book, support Joomla!.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 49 posts ]  Go to page 1, 2  Next



Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group