Creating REALLY Pretty URLs!


So we had a customer who was working with Total CMS and Blog and had a URL similar to this:

http://mysite.com/blog/post/pretty-urls

and they wanted to get rid of the newsletter part of the URL. Here is a simple way to do this.

  1. Blog List page needs to be something like /blog/index.php
  2. Blog Post page needs to be in the same folder as blog list but with a different name: /blog/post.php
  3. Set the Post URL setting in the Blog Post stack to Pro. Set the URL to https://mysite.com/blog/
  4. Use the following .htaccess rules:
    ### Pretty URL rules to paste into your .htaccess file
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule blog/(\S+) /blog/post.php?permalink=$1