viewtopic url

Discussion forum for MOD Writers regarding MOD Development.
Locked
new777
Registered User
Posts: 94
Joined: Thu Oct 03, 2013 6:51 am

viewtopic url

Post by new777 »

Why does a topic url look like this?

domain.com/viewtopic.php?f=13&t=100
and not like this:
domain.com/viewtopic.php?t=100

The url is still valid and it solves the problem for moving a topic to another forum, for any outside links towards it, like on the search engines or just an another website.

Unless there is a good reason to keep the f=??& in the url, can it be removed somehow.

My forum moves a lot of topics.
User avatar
Solidjeuh
Registered User
Posts: 522
Joined: Wed Oct 06, 2010 11:20 pm
Location: Aalst / Belgium
Name: Andy Dm
Contact:

Re: viewtopic url

Post by Solidjeuh »

I guess: Forum ID + Topic number + (Reply) :)
I don't suffer from insanity. I enjoy every minute of it.
new777
Registered User
Posts: 94
Joined: Thu Oct 03, 2013 6:51 am

Re: viewtopic url

Post by new777 »

yes, we all know that, but the forum id is not needed and is a problem when moving topics for serch engines and such
User avatar
Lumpy Burgertushie
Registered User
Posts: 68553
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: viewtopic url

Post by Lumpy Burgertushie »

actually, in some situations on the board, it is needed. and, search engines do not seem to have any problem when you move a post from one forum to another etc. the next time they come by to index it will index the new link just fine.
I would assume that if this was really a problem it would have been a problem since phpbb started and it hasn't.

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
new777
Registered User
Posts: 94
Joined: Thu Oct 03, 2013 6:51 am

Re: viewtopic url

Post by new777 »

I understand that they will get re-indexed, but the wrong URL will still be there and will give an error if someone clicks on it.

Since there is no need for the forum ID to be in the URL, why not remove it all together and solve any problem of dead links once and for all.

My forum has one main posting forum and after about a week any topics that have died of are moved to any other forum, depending on the topics subject. Therefore almost 100% of all original topics are moved.

Couldn't this be done with some sort of .htaccess rewrite.

I understand also that it is sometimes needed, probably for starting a new topic and such, but a rewrite after published, should not be a problem
new777
Registered User
Posts: 94
Joined: Thu Oct 03, 2013 6:51 am

Re: viewtopic url

Post by new777 »

I found this and it seems to work fine:

In viewforum.php change line

Code: Select all

$view_topic_url_params = 'f=' . $topic_forum_id . '&t=' . $topic_id;
to

Code: Select all

$view_topic_url_params = 't=' . $topic_id;
Just wandering if there would be any negative side affects from this?
IF HAVE NOT FOUND ANY


If you also want the topic title link (above the topic) to be without the forum ID:

Code: Select all

// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : ''));
If you have a latest topic title mod, check your includes/mods folder and adjust that file also.

If you want the latest post link (the small page icon) on the index, have the forum ID removed:
includes/functions_display.php
FIND:

Code: Select all

$last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
CHANGE TO:

Code: Select all

$last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
new777
Registered User
Posts: 94
Joined: Thu Oct 03, 2013 6:51 am

Re: viewtopic url

Post by new777 »

This may be set to solved, unless the experts here think it is a very bad idea the changes I made
forforce
Registered User
Posts: 323
Joined: Fri Oct 04, 2013 7:57 am
Contact:

Re: viewtopic url

Post by forforce »

Hi, is your fix working fine ? I want to apply the same thing to my forum . Is it working without bugs or errors? Thank you.

edit: I made the changes , I would also like after posting a topic , to auto set the url without forum id. Do you know what to change to do that ?
Last edited by forforce on Sun Nov 24, 2013 4:29 pm, edited 1 time in total.
https://www.cumseface.eu , We have tutorials for everything / Te ajutam se te descurci singur .
new777
Registered User
Posts: 94
Joined: Thu Oct 03, 2013 6:51 am

Re: viewtopic url

Post by new777 »

Yes, works great and no problems what so ever. :D
Just know that after a new post the forum ID is still there, but you must keep that due to posting.
Once the topic is clicked from viewforum the forum ID is gone
forforce
Registered User
Posts: 323
Joined: Fri Oct 04, 2013 7:57 am
Contact:

Re: viewtopic url

Post by forforce »

How can you remove forum id after posting too ? :) Thank you.
edit: Or make it to auto redirect to a non forum id. If it`s possible.
https://www.cumseface.eu , We have tutorials for everything / Te ajutam se te descurci singur .
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51885
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: viewtopic url

Post by stevemaury »

Search a forum for one of the rewritten posts and see if it is found. Try a Forum feed. Try making one of the rewritten posts a global announcement. Try moving one.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
forforce
Registered User
Posts: 323
Joined: Fri Oct 04, 2013 7:57 am
Contact:

Re: viewtopic url

Post by forforce »

Hmmm , as I see it`s working just fine for me :) I still don`t know how to make forum id not to show in url after I post a new topic. And when I search for a topic is the same thing. Can this be fixed? Thanks in advance.
https://www.cumseface.eu , We have tutorials for everything / Te ajutam se te descurci singur .
Locked

Return to “[3.0.x] MOD Writers Discussion”