How can I use .htm or .html extensions with Site Builder? (v. 2.62 - 2.84)

There are two different ways to use .htm extensions with SiteBuilder. They are both optional and are completely independent of each other, so you can just use one or the other (or both - or neither), depending on your needs.

  1. Site Pages - You can change all the main site pages so they use .htm (or .html) extensions. In other words, the catalog page is catalog.htm instead of catalog.php, and the contact page is contact.htm instead of contact.php, and a page called 'aboutus' is /pages/aboutus.htm instead of /pages/aboutus.php.

    To set up site page mime types, you have to:

    1. Change the page extension in the storeadmin area's Site Settings

    2. Go in via FTP and actually rename all the main files, except stconfig.php and style.php, from .php extensions to .htm (ie. rename catalog.php to catalog.htm). The stconfig.php and style.php extensions should remain .php.

    3. Go in via FTP and actually rename all the pages in the /pages/ folder from .php extensions to .htm (ie. rename /pages/aboutus.php to /pages/aboutus.htm)

    4. Add a MIME type statement (ie. AddType or AddHandler) to the .htaccess file. See our MIME type guide to parse PHP in pages that have .htm or .html extensions.

    5. Make sure any direct links that you have hard coded into your templates are pointing to the new link format.

  2. Catalog Pages (Version 2.62 or higher) - You can also change the page extensions for catalog pages that have an item or category selected (as well as the articles page when an article is selected). This works independently of the site page mime types, and is used mostly for search engine optimization. It changes a page from the format http://website.com/catalog.php?category=7 to http://website.com/category_7/Some-Category.htm

    To set up the catalog page redirects, you have to:

    1. Open the /sbconf/config.php page and add something into the $Cat_Dir, $Item_Dir and $Article_Dir variables. These determine what the links will be. For instance, if you set $Cat_Dir to "jewelry", the category links will look like http://website.com/jewelry_7/Some-Category.htm

    2. In that same file, set the $Static_Ext to whatever extension you want to use. For instance, if it's set to 'html', the link will look like

      http://website.com/category_7/Some-Category.html
    3. Use the MIME type guide to create the .htaccess file code to be added to the .htaccess file in the main directory of your site. (RECOMMENDED!)

      -- OR --

      You can optionally manually set up the htaccess file by doing the following:Optional (Version 2.7x and higher only)! To permanently redirect old catalog pages, open the /enc/openinfo.php page and change $permanent_dynamic to "yes".

      1. Copy the rewrite code in the /staticpages/.htaccess file of the zip folder (everything from ... to ... ) and add it to the main .htaccess file in the site.

      2. If the site builder is loaded into a subdirectory, add the subdirectory into the RewriteBase in the .htaccess file.

      3. If you've made any changes to the directory variables beyond the defaults in the /sbconf/config.php page, you have to make those same changes to the .htaccess file. For instance, if you set $Cat_Dir to "jewelry", you'd have to change all the RewriteRule category... to RewriteRule jewelry...

      4. If you're using the Site Pages Mime Type change (see above), make sure to change the page extensions in the .htaccess file. For instance, if you've changed the site pages to use .html, you'll want to change catalog.php to catalog.html and articles.php to articles.html in the .htaccess file.

    4. Make sure any direct links that you have hard coded into your templates are pointing to the new link format.