XF 1.1 A controller for the route path showthread.php was not found

AndyB

Well-known member
I successfully upgraded to Xenforo from vB4.

If someone from another website clicks on a vB4 link to my site, it comes back with the following error message:

A controller for the route path showthread.php was not found

What setting in .htaccess do I need to enter so that it redirects properly? Here are a few bits of information to help with the answer:

1) I retained the thread and post id's in the conversion
2) I only use thread numbers in my URL on vB4 and xF.

Example of vB4 URL:

http://www.mywebsite.com/forums/showthread.php?t=1234

Example of xF URL that I would like .htaccess to redirect to:

http://www.mywebsite.com/forums/threads/1234/
 
A controller for the route path showthread.php was not found

Apparently XenForo is handling that request as a route. That's not right.

Confirm that the file exists at forums/showthread.php

And please post the contents of your .htaccess file in the forums directory.


The ids are the same? In that case you don't actually need the showthread.php file to redirect. Add these lines to your .htaccess file:

Rich (BB code):
#	Mod_security can interfere with uploading of content such as attachments. If you
#	cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#	SecFilterEngine Off
#	SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{QUERY_STRING} (\?|^)t=([0-9]+)(&|$)
	RewriteRule ^showthread\.php$ /forums/threads/%2/ [R=301,L]

	#	If you are having problems with the rewrite rules, remove the "#" from the
	#	line that begins "RewriteBase" below. You will also have to change the path
	#	of the rewrite to reflect the path to your XenForo installation.
	#RewriteBase /xenforo

	#	This line may be needed to enable WebDAV editing with PHP as a CGI.
	#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

	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]
</IfModule>

That should do it.
 
Hi Jake,

I added the RewriteCond (shown in red) and it works perfect, well almost perfect. The trailing "?t=1234" should be removed.

Thank you kindly for your assistance.
 
Hi Jake,

The RewriteCond works perfect, well almost perfect. The trailing "?t=1234" should be removed.

Thank you kindly for your assistance.

Oh yeah, add an extra ? in the RewriteRule to eliminate the query string from the target:

Rich (BB code):
#	Mod_security can interfere with uploading of content such as attachments. If you
#	cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#	SecFilterEngine Off
#	SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{QUERY_STRING} (\?|^)t=([0-9]+)(&|$)
	RewriteRule ^showthread\.php$ /forums/threads/%2/? [R=301,L]

	#	If you are having problems with the rewrite rules, remove the "#" from the
	#	line that begins "RewriteBase" below. You will also have to change the path
	#	of the rewrite to reflect the path to your XenForo installation.
	#RewriteBase /xenforo

	#	This line may be needed to enable WebDAV editing with PHP as a CGI.
	#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

	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]
</IfModule>
 
Back
Top Bottom