Concrete 5: .htaccess redirect - add .html extension

If you want to add .html extension to the end of the URL, try the code below in your .htaccess file. Also make sure Pretty URL is enabled from Dashboard.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f

# Rewrite rule for displaying as directories
#RewriteRule ^(.*)$ index.php/$1 [L] # disable this

# Rewrite rule for appending .html
RewriteRule ^(.*)\/$ $1.html [R]
RewriteRule ^(.*).html$ index.php/$1 [L]

Comments

  1. Hey thanks a lot for this post...m a newbie...:)

    ReplyDelete
  2. Replies
    1. I thought it was working when I tried. I'd like to hear from other people too regarding this.

      Delete
  3. Replies
    1. Let me know if you've found a better solution?

      Delete

Post a Comment

Popular posts from this blog

How to resolve 'res://ieframe.dll/acr_error.htm#' error (Internet Explorer stopped working while viewing a website)

htaccess: Redirecting multiple domains to the main domain

MailChimp API V2.0 SSL error solution