Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Meddysong Posted May 8, 2019 Posted May 8, 2019 I really like how if you visit https://invisioncommunity.com/4guides, you're automatically redirected to a specific article, https://invisioncommunity.com/4guides/welcome/invision-community-r7/ But how is it done? Is it just nothing more straightforward than a .htaccess redirect? If so, fine, I can do that myself. But I'm curious about whether it's achieved otherwise, say by a line of code on the page itself. If it is, what would such code look like?
opentype Posted May 8, 2019 Posted May 8, 2019 For a listing template, you can just take the first record URL (if there is one) in the loop and forward there. {{\IPS\Output::i()->redirect($row->url(), '', 302);}} That way, it is always automatic. Not sure if their index page uses something similar or a hardcoded forwarding.
Meddysong Posted May 8, 2019 Author Posted May 8, 2019 7 hours ago, opentype said: Not sure if their index page uses something similar or a hardcoded forwarding. A mixture of both has worked for me on the index page: {{\IPS\Output::i()->redirect('welcome', '', 302);}} That redirects to the category with the slug welcome and your code in the listing template ensures that the first article in that category is displayed.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.