b2evolution/b2evolution/master/sample.htaccess - Htaccess File


# Apache configuration for b2evolution's base folder
# Lines starting with # are comments.
# Updated 2016-01-25

<IfModule mod_php5.c>
  # On some overly "secured" systems, the following may need to be added in each folder:
  # AddHandler application/x-httpd-php5 .php

  # The following will try to configure PHP in the way b2evolution would like it to be:
  # However, these falgs will only work if the server configuration allows them...

  # Increase memory limit
  php_value memory_limit 384M

  # Security settings
  php_flag register_globals Off
  php_flag allow_url_include Off
  php_flag magic_quotes_gpc Off

  # For uploading
  php_value upload_max_filesize 32M
  php_value post_max_size 40M

  # You may increase the following if PHP is not able to increase it by itself when needed
  # Otherwiwse it's better to keep the number low enough for general use
  php_value max_execution_time 30
  # You may want to turn the following to Off on production servers
  # Please do this only if you know what you're doing and will be able to retrieve potential errors from your error log
  php_flag display_errors On
  # The following is the same as 'E_ALL & ~ E_STRICT' (except those constants may not be available here)
  php_value error_reporting 30719

  # To avoid warning about the automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version
  php_value always_populate_raw_post_data -1

# Don't show directory contents (not desirable, especially for media folders)
Options -Indexes
# Note: if you have access to the command line of your server, it would probably
# be even better to type this:  a2dismod autoindex
# (This disables the directory listing module completely)

# In case no specific file is requested, we want to fall back to index.php
# In case some subdirectories are accessed, we want to display index.html
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html

# The following will ensure you can pass extra params after the filename on the URL
AcceptPathInfo On

# CATCH EVERYTHING INTO B2EVO: (even if no php file appears in the URL)
# The following will allow you to have a blog running right off the site root,
# using index.php as a stub but not showing it in the URLs.
# This will add support for URLs like:  http://example.com/2006/08/29/post-title
<IfModule mod_rewrite.c>
  RewriteEngine On

  # This line may be needed or not.
  # enabling this would prevent running in a subdir like /blog/index.php
  # RewriteBase /

  # Redirect to REST API controller:
  RewriteRule ^api/v(d+)/(.+)$ htsrv/rest.php?api_version=$1&api_request=$2 [QSA,L]

  # Redirect any .htm .html or no-extension-file that's not an existing file or directory to index.php:
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^[^.]+(.(html|htm))?$ index.php [L]

On Github License


Download PDF of Htaccess file