b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Archives
  3. Pretty URL

Pretty URL

Let’s assume you have a default installation of b2evolution:

  • Blog All can be accessed through index.php?blog=1
  • Blog A can be accessed through index.php?blog=2
  • Blog B can be accessed through index.php?blog=3
  • The Linkblog can be accessed through index.php?blog=4

Let’s start with Blog A

Let’s start with blog A, because it is the easiest. b2evolution ships with an alternative file to call blog A! In your URL, try replacing the end index.php?blog=2 with a_stub.php. You should access the exact same page. That’s because b2evolution ships with the file a_stub.php which is preconfigured for acting as if index.php was called with parameter blog=2.

However, if you now click on an internal link on this page, say "Last comments", you will notice that b2evo throws you back to index.php?blog=2 !

That’s because b2evo doesn’t know (yet) that you want to use a_stub.php instead of index.php?blog=2. You must set this up in the admin, under blogs then Blog A. Under "Preferred access type:", you must select "Explicit reference to stub file (Advanced)" and then name the stub file name in "Stub name:"; here you should enter a_stub.php. Validate your changes.

Now, you can refresh the blog page and click on some links. You will notice that you now stay on a_stub.php and no longer get redirected to index.php?blog=2.

Now with Blog B

Try the same operations as above on blog B (blog number 3) and try to associate it with a stub file named b_stub.php. You will notice that you get a "404 Page not found" error from your webserver!

That is because b2evolution does not ship with a file named b_stub.php !

Now try to duplicate the file a_stub.php as b_stub.php on your webserver.

What happens if you acces this page? You will notice that you no longer get an error, but b_stub.php displays Blog A just as a_stub.php did! This is not what you wanted!

This happens because b_stub.php contains preset parameters so that you don’t have to pass these on the URL. In this case, it contains a hardcoding for blog=2 and blog #2 is blog A, not blog B. (You can see the blog numbers in the admin, under Blogs).

To correct that, you must open the file b_stub.php with a text editor and find the following line:
$blog = 2; // 2 is for "demo blog A" or your upgraded blog (depends on your install)

Replace this line with:
$blog = 3;

Take special care not to forget the $ sign in front of $blog, as well as the semi column ( ; ) at the end of the line. The white space and the comment after // can be omitted.

Save the file (and upload it to your webserver if necessary).

Calling b_stub.php should now work as expected. :)

The file b_stub.php is what we call a Stub File. You may have noticed that it also lets you set other parameters than just the blog number. For more information on this, see StubFiles.

In short, this is how a stub-file looks like

<?php
$blog = 2;   	
$show_statuses = array();
$linkblog_cat = '';
$linkblog_catsel = array( );
$timestamp_min = '';
$timestamp_max = 'now';
require_once dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php';
?>
Created by fatimahnasra • Last edit by fplanque on 2020-06-09 00:24 • •

No feedback yet

On this page

  • Let’s start with Blog A
  • Now with Blog B
  • In short, this is how a stub-file looks like

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
    • Documentation Effort
    • How to call a blog from a subdirectory?
    • Converting WordPress Themes
    • Evoskin and A Template
    • Quick Upgrade Procedure
    • International Manuals
    • Known Issues
    • Online Help
    • Pretty URL
    • Pro WordPress Theme Conversion
    • Skin/Plugin XML Descriptions
    • Template Tag: Item Views
    • Version
    • How to Change the Appearance of my Permalinks
    • CVS / SourceForge
RWD CMS

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque