1 (edited by Cinquante 2008-04-15 12:37)

Topic: Rewrite -> Bad request

Hello

I am french excuse my english.

We are testing the version 1.3 of punbb, and we have some bug.

I migrate my last forum (punbb 1.2 -> http://forum.starshine-online.com/) on punbb 1.3 (http://forumsso.cinquante.info/).

For the moment the migrate is so great. After i will test the rewrite rule. I copy the .htaccess to the root, and i configure the URL Scheme on Folder Based.


I have one bug, when i go ton the last post of the thread i have a bad resquest like that : http://forumsso.cinquante.info/post/240791/#p240791

The probleme is me ? the beta ? wink

Thank for your great job

2 (edited by Cinquante 2008-04-15 14:46)

Re: Rewrite -> Bad request

oh new test !

The correct url is : http://forumsso.cinquante.info/post240791/#p240791 and not http://forumsso.cinquante.info/post/240791/#p240791

You have any solution ?

i have some problems with the function "new post" ...

Re: Rewrite -> Bad request

Are you using the latest revision? or the BETA download?

Re: Rewrite -> Bad request

the last revision

5 (edited by StevenBullen 2008-04-15 16:30)

Re: Rewrite -> Bad request

Tried to repeat the bug on my demo site (in my sig) and cant. So cant really help you. Will leave Smartys for this one. smile

What is weird is that

The first url works fine... but the correct url (the second one) does not.

Also if you go to one of your users profile and click "Show all posts" it does not work. Where if you use the default (default SEF) link it does.

Re: Rewrite -> Bad request

Could you disable any extensions you're using and then try it? If that fails to work, could you paste the contents of your include/rewrite_rules.php file?

7 (edited by Cinquante 2008-04-16 09:37)

Re: Rewrite -> Bad request

Hello i have no extensions with punbb, thx for your help

htaccess

# BEGIN PunBB

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . rewrite.php [L]
</IfModule>

# END PunBB

includes/rewrite.php

<?php
/***********************************************************************

  Copyright (C) 2002-2008  PunBB.org

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


$pun_rewrite_rules = array(
    '/^topic[\/_-]?([0-9]+).*(new|last)[\/_-]?(post)?s?(\.html?|\/)?$/i'                                                    =>    'viewtopic.php?id=$1&action=$2',
    '/^post[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                                    =>    'viewtopic.php?pid=$1',
    '/^(forum|topic)[\/_-]?([0-9]+).*[\/_-]p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                            =>    'view$1.php?id=$2&p=$4',
    '/^(f|t)(orum|opic)[\/_-]?([0-9]+)[\/_-](rss|atom)(\.html?|\/)?$/i'                                                        =>    'extern.php?action=feed&$1id=$3&type=$4',
    '/^(forum|topic)[\/_-]?([0-9]+).*(\.html?|\/)?$/i'                                                                        =>    'view$1.php?id=$2',
    '/^new[\/_-]?reply[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                        =>    'post.php?tid=$1',
    '/^new[\/_-]?reply[\/_-]?([0-9]+)[\/_-]?quote[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                            =>    'post.php?tid=$1&qid=$2',
    '/^new[\/_-]?topic[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                        =>    'post.php?fid=$1',
    '/^(delete|edit)[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                        =>    '$1.php?id=$2',
    '/^(login|search|register)(\.html?|\/)?$/i'                                                                                =>    '$1.php',
    '/^logout[\/_-]?([0-9]+)[\/_-]([a-z0-9]+)(\.html?|\/)?$/i'                                                                =>    'login.php?action=out&id=$1&csrf_token=$2',
    '/^request[\/_-]?password(\.html?|\/)?$/i'                                                                                =>    'login.php?action=forget',
    '/^user[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                                    =>    'profile.php?id=$1',
    '/^user[\/_-]?([0-9]+)[\/_-]?([a-z]+)(\.html?|\/)?$/i'                                                                    =>    'profile.php?section=$2&id=$1',
    '/^(delete|upload)[\/_-]?(avatar|user)?[\/_-]?([0-9]+)[\/_-]?([a-z0-9]+)?(\.html?|\/)?$/i'                                =>    'profile.php?action=$1_$2&id=$3&csrf_token=$4',
    '/^change[\/_-]?(email|pass)(word)?[\/_-]?([0-9]+)[\/_-]([a-zA-Z0-9]+)(\.html?|\/)?$/i'                                    =>    'profile.php?action=change_$1&id=$3&key=$4',
    '/^change[\/_-]?(email|pass)(word)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                        =>    'profile.php?action=change_$1&id=$3',
    '/^search[\/_-]?(new|recent|unanswered|subscriptions)(\.html?|\/)?$/i'                                                    =>    'search.php?action=show_$1',
    '/^search[\/_-]?(new|recent|unanswered|subscriptions)[\/_-]p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                        =>    'search.php?action=show_$1&p=$3',
    '/^search[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                                =>    'search.php?search_id=$1',
    '/^search[\/_-]?([0-9]+)[\/_-]?p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                    =>    'search.php?search_id=$1&p=$3',
    '/^search[\/_-]?(posts|topics)[\/_-]?user[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                =>    'search.php?action=show_user_$1&user_id=$2',
    '/^search[\/_-]?(posts|topics)[\/_-]?user[\/_-]?([0-9]+)[\/_-]?p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                    =>    'search.php?action=show_user_$1&user_id=$2&p=$4',
    '/^search\/k(.*)\/([0-9-]+)\/a(.*)\/(message|subject|all)\/([0-9]+)\/(ASC|DESC)\/(posts|topics)\/?$/i'                    =>    'search.php?action=search&keywords=$1&author=$3&forum=$2&search_in=$4&sort_by=$5&sort_dir=$6&show_as=$7',
    '/^search\/k(.*)\/([0-9-]+)\/a(.*)\/(message|subject|all)\/([0-9]+)\/(ASC|DESC)\/(posts|topics)\/page\/([0-9]+)\/?$/i'    =>    'search.php?action=search&keywords=$1&author=$3&forum=$2&search_in=$4&sort_by=$5&sort_dir=$6&show_as=$7&p=$8',
    '/^search-k(.*)-([0-9-]+)-a(.*)-(message|subject|all)-([0-9]+)-(ASC|DESC)-(posts|topics).html?$/i'                        =>    'search.php?action=search&keywords=$1&author=$3&forum=$2&search_in=$4&sort_by=$5&sort_dir=$6&show_as=$7',
    '/^search-k(.*)-(message|subject|all)-a(.*)-([0-9]+)-(ASC|DESC)-([0-9-]+)-(posts|topics)-p([0-9]+).html?$/i'            =>    'search.php?action=search&keywords=$1&author=$3&forum=$6&search_in=$2&sort_by=$4&sort_dir=$5&show_as=$7&p=$8',
    '/^users(\.html?|\/)?$/i'                                                                                                =>    'userlist.php',
    '/^users\/(.*)\/([0-9-]+)\/?([a-z_]+)[\/_-]([a-zA-Z]+)[\/_-]p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                        =>    'userlist.php?username=$1&show_group=$2&sort_by=$3&sort_dir=$4&p=$6',
    '/^(email|report|subscribe|unsubscribe)[\/_-]?([0-9]+)[\/_-]?([a-z0-9]+)?(\.html?|\/)?$/i'                                =>    'misc.php?$1=$2&csrf_token=$3',
    '/^(mark|rules)[\/_-]?(read)?[\/_-]?([a-z0-9]+)?(\.html?|\/)?$/i'                                                        =>    'misc.php?action=$1$2&csrf_token=$3',
    '/^mark[\/_-](forum)[\/_-]?([0-9]+)[\/_-](read)[\/_-]([a-z0-9]+)(\.html?|\/)?$/i'                                        =>    'misc.php?action=markforumread&fid=$2&csrf_token=$4',
    '/^help[\/_-]([a-z]+)(\.html?|\/)?$/i'                                                                                    =>    'help.php?section=$1',
    '/^moderate[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                                                =>    'moderate.php?fid=$1',
    '/^move_topics[\/_-]?([0-9]+)[\/_-]([0-9]+)(\.html?|\/)?$/i'                                                            =>    'moderate.php?fid=$1&move_topics=$2',
    '/^(open|close|stick|unstick)[\/_-]?([0-9]+)[\/_-]([0-9]+)[\/_-]([a-z0-9]+)(\.html?|\/)?$/i'                            =>    'moderate.php?fid=$2&$1=$3&csrf_token=$4',
    '/^moderate[\/_-]?([0-9]+)[\/_-]?p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                                =>    'moderate.php?fid=$1&p=$3',
    '/^moderate[\/_-]?([0-9]+)[\/_-]([0-9]+)(\.html?|\/)?$/i'                                                                =>    'moderate.php?fid=$1&tid=$2',
    '/^moderate[\/_-]?([0-9]+)[\/_-]([0-9]+)[\/_-]?p(age)?[\/_-]?([0-9]+)(\.html?|\/)?$/i'                                    =>    'moderate.php?fid=$1&tid=$2&p=$4',
    '/^get_host[\/_-]?([0-9]+|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(\.html?|\/)?$/i'                                =>    'moderate.php?get_host=$1'
);

Re: Rewrite -> Bad request

Are you sure you don't have any extensions installed? Have you modified any other files to change the rewrite rules? Because those are the default rewrite rules from SVN, but the results I'm getting from testing your server aren't consistent with every other server I've tested on and aren't even consistent within your own server (eg: if you're having this issue with the post URL, you should be having the same issue with the topic URL, but you're not).
To debug any more, I would need FTP access to your site.

9 (edited by Cinquante 2008-04-16 10:51)

Re: Rewrite -> Bad request

Hum, i don't think to modified some files in punbb or rewrite, but we work in code a lot, i can lost my mind. May be the probleme come to the server configuration ?

Well i send you an email with my ftp pass. Good luck and excuse my english.

Thx for your work

Re: Rewrite -> Bad request

Something I didn't pick up on:
http://forumsso.cinquante.info/postssafs
A regular rewrite failure just has a blank white page: this is something else.

And yes, I got your details, I'm checking it out now but I may have to finish later in the day.

Re: Rewrite -> Bad request

I've just determined that the issue is separate from PunBB's rewrite scheme: it still goes to that regular Bad request page even when rewriting has an exit in it that means it should just return a blank white screen.
In other words, check out your server configuration and figure out why you're redirecting /post/* somewhere tongue

Re: Rewrite -> Bad request

i think he has installed the delete log old version extension ... that was the problem with me too but it is fixed in the new version of that extension....


and can u post ur location of the root directory and the htaccess file ...

MyFootballCafe.com  is Now Online!

Re: Rewrite -> Bad request

SuperMAG: I already confirmed that there are no extensions and that the problem is unrelated to PunBB's rewrite system wink

14 (edited by Irulan 2008-04-16 15:37)

Re: Rewrite -> Bad request

There is a post.php in the root directory ... RewriteCond %{REQUEST_FILENAME} !-f may match as "/info" calls "/info.php"

It's possible to bypass this problem this this rewrite condition :

## BEGIN PunBB

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} "post"
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . rewrite.php [L]
</IfModule>

# END PunBB

Re: Rewrite -> Bad request

can you tell me your punbb root directory ... because ...

if  public_ html/punbb/ directory ...

then you need to change your htaccess file line to

from
RewriteBase /
to
RewriteBase /punbb

MyFootballCafe.com  is Now Online!

Re: Rewrite -> Bad request

SuperMAG: That's not the issue
Irulan: You're right, that is the issue here, although it shouldn't happen: that's not a default Apache behavior, at least.

Re: Rewrite -> Bad request

I looked for it in the "apache config", and i found nothing.
On my server, i used the command / -exec grep Rewrite {} \; -print, and found nothing again
Thanks in advance for your help!

Re: Rewrite -> Bad request

I don't think it's necessarily rewrite, it looks like it's Apache serving up files even without their extensions.

Re: Rewrite -> Bad request

http://www.websiteoptimization.com/speed/tweak/rewrite/
Could this be the issue?

Try adding

Options -MultiViews

to the top of the .htaccess file.