Support

Admin Tools

#15418 phpBB3 and .thacess

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by BO-Samson on Thursday, 14 March 2013 14:23 CDT

BO-Samson

Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? Yes
Have I searched the tickets before posting? Yes
Have I read the documentation before posting (which pages?)? Yes
Joomla! version: (3.03)
PHP version: (5.2.17)
MySQL version: (5.1.49-3~bpo50+1-log)
Host: (HostEurope vServer)
Admin Tools version: (2.5.2)

Description of my issue:

Hello,

about 10 days ago, I switched from Joomla 2.5 to 3. It was no upgrade, but a complete new installation. Everything works great. But now google reports a high amount of 404-errors. This errors come up, because my forum-links are not processed well.

I use p8pBB-bridge from Alterbrains. I already did at Joomla 2.5. There are some .thaccess rules, which "translate" adresses like http://www.burn-out-forum.de/forum/viewtopic.php?f=79&t=6097 to http://www.burn-out-forum.de/forum/viewtopic/79/6097. This does not work like before. Now it only works, when the ".php"-ending is deleted manually. The link http://www.burn-out-forum.de/forum/viewtopic?f=79&t=6097 will result in http://www.burn-out-forum.de/forum/79/6097.

The .htaccess-rules are:

RewriteCond %{REQUEST_FILENAME} /phpBB3(\/?)$
RewriteRule (.*) /forums [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/index.php
RewriteRule (.*) /forums?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/ucp.php
RewriteRule (.*) /forums/user?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/viewforum.php
RewriteRule (.*) /forums/forum?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/viewtopic.php
RewriteRule (.*) /forums/topic?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/memberlist.php
RewriteRule (.*) /forums/members?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/report.php
RewriteRule (.*) /forums/report?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/posting.php
RewriteRule (.*) /forums/post?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/mcp.php
RewriteRule (.*) /forums/moderator?%{QUERY_STRING} [R=301,L]

I have many links pointing to my site, which have this ".php" in it. Is there a possibilty to make it work like before?

Regards
Samson

nicholas
Akeeba Staff
Manager

Hello Samson,

.htaccess Maker comes with a built-in protection: it blocks access to arbitrary .php files. You will need to add forums in the list of directories where all files (including .php) are allowed. It doesn't matter if the directory doesn't exist; putting it there will instruct .htaccess Maker to not try to block requests if they reference .php files and they begin with forums/ which is exactly what you need in your case.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

BO-Samson

Hallo,

thank you for your fast answer.

I already tried this. Putting "forums" or "forums/" to exceptions (phpBB3 is already there) causes 404-errors in the complete forum. The error is not shown in Joomla-style. No forum-link will work any more. Even the links in forum-index will not work any more. :-(

I am afraid, google will not reward this.

Any other suggestions?

Regards
Samson

nicholas
Akeeba Staff
Manager

Your forum rewrite rules should be placed in a .htaccess file inside the forums directory.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

BO-Samson

Hi,

thanks again, but same effect. When I place the rules in forums directory and delete them from ht.access-maker, then there is no change.

When putting the exception for folder "forums" (.php allowed), no link will work. May this be a problem of the bridge? But this rules alway worked an Joomla 2.5.

.thaccess - a book with seven seals, for me.

Regards
Samson

nicholas
Akeeba Staff
Manager

In the .htaccess you create inside /forums you have to set

RewriteEngine On
RewriteBase /forums

and remove the /forums part from your rewrite rules. I believe you didn't do either :)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

BO-Samson

Okay, I tried...

my .htaccess in folder phpBB3 looks like:

RewriteEngine On
RewriteBase /forum
RewriteCond %{REQUEST_FILENAME} /phpBB3(\/?)$
RewriteRule (.*) /forum [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/index.php
RewriteRule (.*) /forum?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/ucp.php
RewriteRule (.*) /forum/user?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/viewforum.php
RewriteRule (.*) /forum/forum?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/viewtopic.php
RewriteRule (.*) /forum/topic?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/memberlist.php
RewriteRule (.*) /forum/members?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/report.php
RewriteRule (.*) /forum/report?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/posting.php
RewriteRule (.*) /forum/post?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /phpBB3/mcp.php
RewriteRule (.*) /forum/moderator?%{QUERY_STRING} [R=301,L]

 

And my .htaccess in / folder looks like:

##### RewriteEngine enabled - BEGIN
RewriteEngine On
##### RewriteEngine enabled - END

##### RewriteBase set - BEGIN
RewriteBase /
##### RewriteBase set - END

##### File execution order -- BEGIN
DirectoryIndex index.php index.html
##### File execution order -- END

##### No directory listings -- BEGIN
IndexIgnore *
Options All -Indexes
##### No directory listings -- END

##### Common hacking tools and bandwidth hoggers block -- BEGIN
SetEnvIf user-agent "Indy Library" stayout=1
SetEnvIf user-agent "libwww-perl" stayout=1
SetEnvIf user-agent "Download Demon" stayout=1
SetEnvIf user-agent "GetRight" stayout=1
SetEnvIf user-agent "GetWeb!" stayout=1
SetEnvIf user-agent "Go!Zilla" stayout=1
SetEnvIf user-agent "Go-Ahead-Got-It" stayout=1
SetEnvIf user-agent "GrabNet" stayout=1
SetEnvIf user-agent "TurnitinBot" stayout=1
deny from env=stayout
##### Common hacking tools and bandwidth hoggers block -- END

##### Redirect index.php to / -- BEGIN
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^index\.php$ http%2://www.burn-out-forum.de/ [R,L]
##### Redirect index.php to / -- END
##### Redirect non-www to www -- BEGIN
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R,L]
##### Redirect non-www to www -- END

##### Rewrite rules to block out some common exploits -- BEGIN
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_(en|de)code\(.*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
##### Rewrite rules to block out some common exploits -- END
##### File injection protection -- BEGIN
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]
RewriteRule .* - [F]
##### File injection protection -- END

##### Advanced server protection rules exceptions -- BEGIN
RewriteRule ^administrator\/components\/com_akeeba\/restore\.php$ - [L]
RewriteRule ^administrator\/components\/com_admintools\/restore\.php$ - [L]
RewriteRule ^administrator\/components\/com_joomlaupdate\/restore\.php$ - [L]
RewriteRule ^templates\/jsn_epic_pro/ - [L]
RewriteRule ^phpBB3/ - [L]
RewriteRule ^forum/ - [L]
##### Advanced server protection rules exceptions -- END

##### Advanced server protection -- BEGIN

RewriteCond %{QUERY_STRING} \=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} [NC]
RewriteRule .* - [F]
## Back-end protection
RewriteRule ^administrator/?$ - [L]
RewriteRule ^administrator/index\.(php|html?)$ - [L]
RewriteRule ^administrator/index[23]\.php$ - [L]
RewriteRule ^administrator/(components|modules|templates|images|plugins)/.*\.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|htm|ttf|woff|eot)$ - [L]
RewriteRule ^administrator/ - [F]
## Allow limited access for certain Joomla! system directories with client-accessible content
RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/.*\.(jpe|jpg|jpeg|jp2|jpe2|png|gif|bmp|css|js|swf|html|mpg|mp3|mpeg|mp4|avi|wav|ogg|ogv|xls|xlsx|doc|docx|ppt|pptx|zip|rar|pdf|xps|txt|7z|svg|odt|ods|odp|flv|mov|ico|htm|ttf|woff|eot)$ - [L]
RewriteRule ^(components|modules|templates|images|plugins|media|libraries|media/jui/fonts)/ - [F]
## Disallow front-end access for certain Joomla! system directories (unless access to their files is allowed above)
RewriteRule ^includes/js/ - [L]
RewriteRule ^(cache|includes|language|logs|tmp)/ - [F]
RewriteRule ^(configuration\.php|CONTRIBUTING\.md|htaccess\.txt|joomla\.xml|LICENSE\.txt|phpunit\.xml|README\.txt|web\.config\.txt) - [F]

## Disallow access to rogue PHP files throughout the site, unless they are explicitly allowed
RewriteCond %{REQUEST_FILENAME} (\.php)$
RewriteCond %{REQUEST_FILENAME} !(/index[23]?\.php)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*\.php)$ - [F]
## Disallow access to htaccess.txt, php.ini and configuration.php-dist
RewriteRule ^(htaccess\.txt|configuration\.php-dist|php\.ini)$ - [F]
##### Advanced server protection -- END

##### Joomla! core SEF Section -- BEGIN
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json|file|vcf))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
##### Joomla! core SEF Section -- END

Effect: every link is broken. Only forum-index will work. When deleting "forum/"  from exceptions, all links work, but not the links with ".php" inside.

The real folder for the board is "forum", not forums. I always considered this. In my first question I postet the standard-rules.

Regards
Samson

 

 

nicholas
Akeeba Staff
Manager

You can always turn off the front-end and back-end protection features of .htaccess Maker. Of course this will degrade the security of your site, but if Google ranking of your forum pages is more important that's all you can do. BTW, since you already have 301 redirections in place, I seriously doubt that Google has any old pages indexed. If you have the 301 redirections in place for over 3 months Google (and other search engines) have already replaced the URLs in their cache. But in the end of the day it's your site and your choice.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

BO-Samson

Okay, I understund. You are right, there are no wrong links from google. The links from older sites to my page are the "problem". I think, best way will be to ignore these errors.

It will take same time, until the others will change their links. I can not inform them of the changes made in my site, because there are thousands of links to www.burn-out-forum.de.

Thank you for your fast and kind help! I will further use front-end and back-end protection. Security IS more important for me!  ;-)

Regards
Samson

nicholas
Akeeba Staff
Manager

You're welcome, Samson :)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

BO-Samson

I now got answer from Alterbrains. For everybody with the same problem: You need to insert following lines an the beginning of p8pBB-.htacces-rules: 

RewriteRule ^forum/viewtopic.php /forum/topic?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /forum/viewtopic.php
RewriteRule (.*) /forum/topic?%{QUERY_STRING} [R=301,L]

RewriteCond %{REQUEST_FILENAME} /forum/viewforum.php
RewriteRule (.*) /forum/forum?%{QUERY_STRING} [R=301,L]

Then everything will work fine in Joomla 3, too.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!