Mod Rewrite problem after update to 3.2 from phpBB SEO

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
CardinalFang
Registered User
Posts: 5
Joined: Mon Jan 16, 2017 5:20 am

Re: Mod Rewrite problem after update to 3.2 from phpBB SEO

Post by CardinalFang »

stevemaury wrote: Mon Mar 06, 2017 3:08 pm Yes, but the topic number is unique. The forum_id is not needed. I have removed the "f=556" from this link:
https://www.phpbb.com/community/viewtopic.php?&t=2411191 and it still goes the same place.

viewtopic.php?&t=2411191
A lot of the time those additional arguments don't change where it's going, they just fill variables to be used within the page that's being displayed. That f=566 may not change what you see when the page loads but it could be important for metrics or any number of under-the-hood things
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: Mod Rewrite problem after update to 3.2 from phpBB SEO

Post by 3Di »

One of those under-the-hoods thing is that without such a "f" bit you don't appear in the online list, like a "ghost user". https://tracker.phpbb.com/browse/PHPBB3-15060
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
lizardx
Registered User
Posts: 21
Joined: Fri Feb 24, 2017 10:19 am

Re: Mod Rewrite problem after update to 3.2 from phpBB SEO

Post by lizardx »

Can nobody help? :(

It doesn't matter if f=556&t=2411191 or just t=2411191.... I just want to redirect urls like

topic1.html
topic2.html
and so on

to...

viewtopic.php?=1
viewtopic.php?=2
and so on
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Mod Rewrite problem after update to 3.2 from phpBB SEO

Post by canonknipser »

It's all in the previous posts:
take your redirects from your old .htaccess

Code: Select all

#####################################################
# PHPBB SEO REWRITE RULES ALL MODES
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^forum\.html$ /index.php [QSA,L,NC]
# FORUM ALL MODES
RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)(-([0-9]+))?\.html$ /viewforum.php?f=$2&start=$4 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER ALL MODES
RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$2&t=$4&start=$6 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM ALL MODES
RewriteRule ^([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$3&start=$5 [QSA,L,NC]
# PHPBB FILES ALL MODES
RewriteRule ^resources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ /download/file.php?id=$2&t=$1 [QSA,L,NC]
# PROFILES ALL MODES WITH ID
RewriteRule ^(member|[a-z0-9_-]*-u)([0-9]+)/?$ /memberlist.php?mode=viewprofile&u=$2 [QSA,L,NC]
# USER MESSAGES ALL MODES WITH ID
RewriteRule ^(member|[a-z0-9_-]*-u)([0-9]+)/(topics|posts)/?(page([0-9]+)\.html)?$ /search.php?author_id=$2&sr=$3&start=$5 [QSA,L,NC]
# GROUPS ALL MODES
RewriteRule ^(group|[a-z0-9_-]*-g)([0-9]+)(-([0-9]+))?\.html$ /memberlist.php?mode=group&g=$2&start=$4 [QSA,L,NC]
# POST
RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L,NC]
# ACTIVE TOPICS
RewriteRule ^active-topics(-([0-9]+))?\.html$ /search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^unanswered(-([0-9]+))?\.html$ /search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^newposts(-([0-9]+))?\.html$ /search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# UNREAD POSTS
RewriteRule ^unreadposts(-([0-9]+))?\.html$ /search.php?search_id=unreadposts&start=$2 [QSA,L,NC]
# THE TEAM
RewriteRule ^the-team\.html$ /memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

It's all documented in the line before the rewrite rule.
Check all those line if you need those redirects, e,g, active-topics, unanswered etc. you don't need any longer.
If you are unsure what they mean, check the official documentation of mod_rewrite: http://httpd.apache.org/docs/current/mo ... ewriterule
lizardx wrote: Mon Mar 06, 2017 2:17 pm A think I must get new Mod Rewrite Rules with 301 to solve this problem...
Just put the R=301 in the square brackets at the end of the line as in some lines already there:

Code: Select all

# FIX RELATIVE PATHS : IMAGES
RewriteRule ^.+/(styles/.*|images/.*)/$ /$1 [QSA,L,NC,R=301]
Put them in your current .htaccess after the standard redirects, save, clear cache, call any old link to check...
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
lizardx
Registered User
Posts: 21
Joined: Fri Feb 24, 2017 10:19 am

Re: Mod Rewrite problem after update to 3.2 from phpBB SEO

Post by lizardx »

@ Frank

thank you very much for your help. But it still doesn't work :(

I changed the code to

Code: Select all

[QSA,L,NC,R=301]
- But after uploading the htaccess I get this error:
Die Seite www.domain.de funktioniert nicht

www.domain.de kann diese Anfrage momentan nicht verarbeiten.
HTTP ERROR 500

Here is my current htaccess:

Code: Select all

AddHandler af_php56 .php

<IfModule mod_rewrite.c>
RewriteEngine on

# Uncomment the statement below if URL rewriting doesn't
# work properly. If you installed phpBB in a subdirectory
# of your site, properly set the argument for the statement.
# e.g.: if your domain is test.com and you installed phpBB
# in http://www.test.com/phpBB/index.php you have to set
# the statement RewriteBase /phpBB/
#
RewriteBase /

#
# Uncomment the statement below if you want to make use of
# HTTP authentication and it does not already work.
# This could be required if you are for example using PHP via Apache CGI.
#
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

#
# The following 3 lines will rewrite URLs passed through the front controller
# to not require app.php in the actual URL. In other words, a controller is
# by default accessed at /app.php/my/controller, but can also be accessed at
# /my/controller
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]

#
# If symbolic links are not already being followed,
# uncomment the line below.
# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/
#
#Options +FollowSymLinks
</IfModule>

# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
<IfModule mod_version.c>
	<IfVersion < 2.4>
		<Files "config.php">
			Order Allow,Deny
			Deny from All
		</Files>
		<Files "common.php">
			Order Allow,Deny
			Deny from All
		</Files>
	</IfVersion>
	<IfVersion >= 2.4>
		<Files "config.php">
			Require all denied
		</Files>
		<Files "common.php">
			Require all denied
		</Files>
	</IfVersion>
</IfModule>
<IfModule !mod_version.c>
	<IfModule !mod_authz_core.c>
		<Files "config.php">
			Order Allow,Deny
			Deny from All
		</Files>
		<Files "common.php">
			Order Allow,Deny
			Deny from All
		</Files>
	</IfModule>
	<IfModule mod_authz_core.c>
		<Files "config.php">
			Require all denied
		</Files>
		<Files "common.php">
			Require all denied
		</Files>
	</IfModule>
</IfModule>




#####################################################
# PHPBB SEO REWRITE RULES ALL MODES
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^forum\.html$ /index.php [QSA,L,NC]
# FORUM ALL MODES
RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)(-([0-9]+))?\.html$ /viewforum.php?f=$2&start=$4 [QSA,L,NC,R=301]
# TOPIC WITH VIRTUAL FOLDER ALL MODES
RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$2&t=$4&start=$6 [QSA,L,NC,R=301]
# TOPIC WITHOUT FORUM ID & DELIM ALL MODES
RewriteRule ^([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$3&start=$5 [QSA,L,NC,R=301]
# PHPBB FILES ALL MODES
RewriteRule ^resources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ /download/file.php?id=$2&t=$1 [QSA,L,NC,R=301]

Perhaps there is another code I have to delete before?


I also deleted the phpBB cache in the adminarea and my browsercache, too. I tried lot of things, but every time without success. You can visit my site on www.slackline-tipps.de/forum

Here is one older url which should redirect: http://www.slackline-tipps.de/forum/topic73.html

My htaccess file is in the folder slackline-tipps.de/forum
I have another htaccess of the original Wordpress in the root.
Mirrabeau
Registered User
Posts: 13
Joined: Tue Oct 05, 2021 2:27 pm

Re: Mod Rewrite problem after update to 3.2 from phpBB SEO

Post by Mirrabeau »

[SOLVED] (at least for me?)

If this may help, I had the same issue when moving from 3.0.14 to 3.3.5.
All of my previous links generated by SEO were facing a 404 error.
All links from outside our forum, all links within posts using those *.html urls were dead,
All bots parsing old urls were facing 404 errors, with the logical consequence on search engine results.

I finally reviewed my .htaccess based on the new one (for app.php)
and added my SEO rules BEFORE app.php ones.

The result :

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine on

#
# Uncomment the statement below if URL rewriting doesn't
# work properly. If you installed phpBB in a subdirectory
# of your site, properly set the argument for the statement.
# e.g.: if your domain is test.com and you installed phpBB
# in http://www.test.com/phpBB/index.php you have to set
# the statement RewriteBase /phpBB/
#
#RewriteBase /

#
# Uncomment the statement below if you want to make use of
# HTTP authentication and it does not already work.
# This could be required if you are for example using PHP via Apache CGI.
#
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

#
# The following 3 lines will rewrite URLs passed through the front controller
# to not require app.php in the actual URL. In other words, a controller is
# by default accessed at /app.php/my/controller, but can also be accessed at
# /my/controller
#

# SEO START
# Adjust the RewriteBase below with your phpbb path
RewriteBase /forum

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} forums.html
RewriteRule (.*) index.php [L]

RewriteCond %{REQUEST_URI} forum([0-9]*)-([0-9]*)-([a-zA-Z]*)-([a-zA-Z]*)-([0-9]*).html
RewriteRule (.*) viewforum.php?f=%1&st=%2&sk=%3&sd=%4&start=%5 [L]

RewriteCond %{REQUEST_URI} forum([0-9]*)-([0-9]*)-([a-zA-Z]*)-([a-zA-Z]*).html
RewriteRule (.*) viewforum.php?f=%1&st=%2&sk=%3&sd=%4 [L]

RewriteCond %{REQUEST_URI} forum([0-9]*)-([0-9]*).html
RewriteRule (.*) viewforum.php?f=%1&start=%2 [L]

RewriteCond %{REQUEST_URI} forum([0-9]*).html
RewriteRule (.*) viewforum.php?f=%1 [L]

RewriteCond %{REQUEST_URI} forum([0-9]*)_(.*).html
RewriteRule (.*) viewforum.php?f=%1 [L]

RewriteCond %{REQUEST_URI} ltopic([0-9]*).html
RewriteRule (.*) viewtopic.php?p=%1#p%1 [L]

RewriteCond %{REQUEST_URI} ltopic([0-9]*)-([0-9]*).html
RewriteRule (.*) viewtopic.php?t=%1&p=%2#p%2 [L]

RewriteCond %{REQUEST_URI} ftopic([0-9]*).html
RewriteRule (.*) viewtopic.php?t=%1 [L]

RewriteCond %{REQUEST_URI} ftopic([0-9]*)_(.*).html
RewriteRule (.*) viewtopic.php?t=%1 [L]

RewriteCond %{REQUEST_URI} ftopic([0-9]*)-([0-9]*).html
RewriteRule (.*) viewtopic.php?t=%1&start=%2 [L]

RewriteCond %{REQUEST_URI} ptopic([0-9]*).html
RewriteRule (.*) viewtopic.php?t=%1&view=previous [L]

RewriteCond %{REQUEST_URI} ntopic([0-9]*).html
RewriteRule (.*) viewtopic.php?t=%1&view=next [L]

RewriteCond %{REQUEST_URI} ftopic([0-9]*)-([0-9]*)-([0-9]*)-([a-zA-Z]*)-([a-zA-Z]*)-([0-9]*).html
RewriteRule (.*) viewtopic.php?f=%1&t=%2&st=%3&sk=%4&sd=%5&start=%6 [L]

RewriteCond %{REQUEST_URI} ftopic([0-9]*)-([0-9]*)-([0-9]*)-([0-9]*)-([a-zA-Z]*)-([a-zA-Z]*).html
RewriteRule (.*) viewtopic.php?f=%1&t=%2&start=%3&st=%4&sk=%5&sd=%6 [L]

RewriteCond %{REQUEST_URI} ftopic([0-9]*)-([0-9]*)-([0-9]*)-([a-zA-Z]*)-([a-zA-Z]*).html
RewriteRule (.*) viewtopic.php?f=%1&t=%2&st=%3&sk=%4&sd=%5 [L]

RewriteCond %{REQUEST_URI} stopic([0-9]*)-([0-9]*)-([0-9]*)-([^&]*).html
RewriteRule (.*) viewtopic.php?f=%1&t=%2&p=%3&hilit=%4#p%3 [L]

RewriteCond %{REQUEST_URI} stopic([0-9]*)-([0-9]*)-([^&]*).html
RewriteRule (.*) viewtopic.php?f=%1&t=%2&hilit=%3 [L]

RewriteCond %{REQUEST_URI} forum.html
RewriteRule (.*) viewforum.php

# SEO END

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]

#
# If symbolic links are not already being followed,
# uncomment the line below.
# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/
#
#Options +FollowSymLinks

</IfModule>
Now all my old urls are working fine, app.php is working fine too.

Hope this helps.
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3733
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Mod Rewrite problem after update to 3.2 from phpBB SEO

Post by Kailey »

Please don't bump topics that are 5 years old. While we appreciate you sharing your solution, the original poster has most likely moved on or figured it out for themselves. ;)
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
Locked

Return to “[3.2.x] Support Forum”