1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 page URL problem in threads list

Discussion in 'XenForo Questions and Support' started by c5mt, Jan 22, 2015.

  1. c5mt

    c5mt Member

    i have a little problem with pages url when threads are listed
    it gives page not found on url domain.com/forum/thread-title.123/page.2
    when i mouse over on page number it shows as domain.com/forum/thread-title.123/page-2 but goas to dot on loading and give error.
    where the problem could be
     
  2. Mike

    Mike XenForo Developer Staff Member

    Can you provide us an example where we can see this? (I'm unable to load the URL in your customer account.)
     
  3. c5mt

    c5mt Member

    Here is exact URL
    HTML:
    http://forum.studentville.it/forums/matematica.41/
    it loads but it will not be loaded if you go to page 2 or so on
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Your installation is quite heavily customised.

    Does it work in a default style and language with all add-ons disabled?

    Hovering over the pagination link, it correctly shows with a -, so something is rewriting it to a .

    Ahh, interesting, that time it tried to load with the - and I got a redirect loop: http://forum.studentville.it/forums/matematica.41/page-4
    Do you have anything in .htaccess?
     
  5. c5mt

    c5mt Member

    i tried on default style but it dose same
    here is my htaccess
    Code:
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
    
      #RewriteRule ^(.*)/([0-9]+)-(.*).html$ /threads/$3-$2/ [R=301,L]
    
    
        RewriteCond %{REQUEST_FILENAME} -f [OR]
    
        RewriteCond %{REQUEST_FILENAME} -l [OR]
    
        RewriteCond %{REQUEST_FILENAME} -d
    
        #RewriteRule ^.*$ - [NC,L]
    
        RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    
        #RewriteRule ^.*$ index.php [NC,L]
    
    This is also customized i uploaded it default one from package files however now it gives error
    This webpage has a redirect loop where it could be
     
    Last edited: Jan 23, 2015
  6. Mike

    Mike XenForo Developer Staff Member

    I'm confused as to why there are standard rules that have been commented out there.

    The redirect doesn't appear to be related to XF itself as there's a header that XF generates on any page that is output in the "standard" way. It does look like it may be generated via PHP though. Please confirm with the default .htaccess and all add-ons disabled.
     
  7. c5mt

    c5mt Member

    all plugins disabled put default htaccess but its still there
     
  8. c5mt

    c5mt Member

    Yes thank you very much for your cooperation
    it was generated via PHP i fount it in index file and disabling it helped to fix
    thanks once again
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    Out of interest, which file?
    From an add-on or something custom to your site?
     
  10. c5mt

    c5mt Member

    custom to site
    found this code in index
    Code:
    sv_redirect();
    
    function sv_redirect(){
        $str = router301_full_url();
    
        $array = array();
        preg_match("/(.*)-(\d*)/", $str,$array);
       
        $id = end($array);
       
        if(!$id){
            return false;
        }
       
       
        $pos = strpos($str,$id)-1;
       
        $char = substr($str,$pos,1);
       
        if($char == '-'){}
           
        $string = str_split($str);
        $string[$pos] = '.';
       
        $string = implode($string);
       
        header("HTTP/1.1 301 Moved Permanently"); 
        header("Location: $string");
        exit();
    }
    
    
    function router301_full_url()
            {
               $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
               $sp = strtolower($_SERVER["SERVER_PROTOCOL"]);
               $protocol = substr($sp, 0, strpos($sp, "/")) . $s;
               $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
               return utf8_encode($protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']);
            }
    
     

Share This Page