Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Possible to rewrite old url's ?


After converting from phpbb to vanilla the links users posted on phpbb to other topics no longer work because the url has changed. Is it possible to fix this with a rewrite rule ? (I'm on Apache). URL's look like this:


Thanks for your input !


  • x00x00 MVP
    edited October 2014
    RewriteRule ^(.*?)-t([0-9]+)\.html$ discussion/$2/$1 [L]

    grep is your friend.

  • You may want to use [R=301] instead of [L]

    grep is your friend.

  • Thanks @x00 that was beyond my grep knowledge. Both links now lead to the correct page. Thanks.

  • Why is that @x00 ? When I make that change I get a "page not found"

  • It's probably clashing with other rewrite rules. Try both: [R=301,L]

  • piotrnlpiotrnl New
    edited October 2014

    This is my .htaccess. I'm not to familiar with Apache. When I add the suggested R=301 I get a page not found.

    `# Modified

    RewriteEngine On

    # Certain hosts may require the following line.

    # If vanilla is in a subfolder then you need to specify it after the /.

    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)

    # RewriteBase /

    RewriteRule ^(.*?)-t([0-9]+).html$ discussion/$2/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]


  • RewriteRule ^(.*?)-t([0-9]+).html$ %{REQUEST_SCHEME}://%{HTTP_HOST}/discussion/$2/$1 [L, R=301]

    grep is your friend.

  • peregrineperegrine MVP
    edited October 2014

    also, you may have another issue. What folder is your forum in? by removing the # on RewriteBase line

    if so read this

    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
    # RewriteBase /

    and change accordingly. e.g.

    if in root folder

    RewriteBase /

    if in vanilla

    RewriteBase /vanilla

    if forum is located in /Sometherfolder

    RewriteBase /Sometherfolder

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • My forum is root @peregrine hence the # ;-)

Sign In or Register to comment.