eZ Documentation Center

This is outdated documentation made for eZ Publish Platform 5.2. It is being moved into the eZ Publish 5.x documentation, so please go there for most up-to-date documentation.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 1


These rewrite rules can be used if you don't have direct access to alter the virtual host configuration, which is common in a shared hosting setup. The file ".htaccess_root" is included in the installation package of your eZ Publish installation. In order to activate these rewrite rules in your hosted environment, you must change the name of the file to ".htaccess" and keep in the same folder as the original ".htaccess_root" file.

.htaccess file example

Please find an example of the ".htaccess" rewrite rules below:

Code Block
No Format
# Copy this file to a new file called .htaccess in your eZ Publish root
# to secure your installation by turning on .htaccess based virtual host mode.

# Environment.
# Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration
# Defaults to "prod" if omitted

# Whether to use Symfony's ApcClassLoader.
# Possible values: 0 or 1
# Defaults to 0 if omitted

# Prefix used when USE_APC_CLASSLOADER is set to 1.
# Use a unique prefix in order to prevent cache key conflicts
# with other applications also using APC.
# Defaults to "ezpublish" if omitted

# Whether to use debugging.
# Possible values: 0 or 1
# Defaults to 0 if omitted, unless ENVIRONMENT is set to: "dev"

# Whether to use Symfony's HTTP Caching.
# Disable it if you are using an external reverse proxy (e.g. Varnish)
# Possible values: 0 or 1
# Defaults to 1 if omitted, unless ENVIRONMENT is set to: "dev"

# Defines the proxies to trust.
# Separate entries by a comma
# Example: ","
# By default, no trusted proxies are set
DirectoryIndex index.php
RewriteEngine On

# skip "real" requests
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [QSA,L]

# CVE-2012-6432
# Uncomment if you have Symfony v2.1.5 or superior
# eZ Publish 5.0 EE is shipped with Symfony v2.1.4
RewriteRule ^/_internal/ - [R=403,L]

# Uncomment in FastCGI mode or when using PHP-FPM, to get basic auth working.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# v1 rest API is on Legacy
RewriteRule ^/api/[^/]+/v1/ /RewriteRule ^api/ index_rest.php [L]

# If using cluster, uncomment the following two lines:
#RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /index_cluster.php RewriteRule ^index_rest\.php - [L]
#RewriteRuleRewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/content/treemenu.* /index_clustertreemenu\.php [L]

RewriteRule ^^var/var/([^/]+/)?storage/images(-versioned)?/.* - [L]
RewriteRule ^^var/var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
RewriteRule ^/design/[^/]+/(stylesheets|images|javascript|fonts)/.* - [L]
RewriteRule ^^share/share/icons/.* - [L]
RewriteRule ^^extension/extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
RewriteRule ^^packages/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule ^^packages/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^^var/var/storage/packages/.* - [L]
# TouchMakes icon,it sitepossible bookmarkto tileplaced andyour favicon:
RewriteRule ^/favicon.*\.(ico|png)$ at the root of your
# eZ Publish instance. It will then be served directly.
RewriteRule ^favicon\.ico - [L]

# Uncomment the line below if you want you favicon be served # from the standard design.
# You can customize the path to # favicon.ico by changingreplacing /design/standard/images/favicon\.ico
# by the adequate path.
#RewriteRule ^/favicon^favicon\.ico /design/standard/images/favicon\.ico [L]
RewriteRule ^^design/design/standard/images/favicon\.ico - [L]
# Give direct access to robots.txt for use by crawlers (Google, # Bing, Spammers..)
RewriteRule ^/robots^robots\.txt - [L]
# PlatformUncomment forthe Privacyfollowing Preferenceslines Projectwhen (using P3Ppopup )style relateddebug.
# for Internet Explorer
# More info here :
RewriteRule ^/w3c/p3p\.xmlRewriteRule ^var/cache/debug\.html.* - [L]

# Uncomment the following lines when using popup style debug in legacy
#RewriteRule ^/var/(RewriteRule ^var/[^/]+/)?cache/debug\.html.* - [L]
# FollowingPlatform rulefor isPrivacy neededPreferences toProject correctly( displayP3P assets) fromrelated eZfiles Publish5for /Internet Symfony bundles
RewriteRule ^/bundles/ - [L]

# Additional Assetic rules for eZ Publish 5.1 / 2013.4 and higher:
RewriteRule ^/css/.*\.css - [L]
RewriteRule ^/js/.*\.jsExplorer
# More info here :
RewriteRule ^w3c/p3p\.xml - [L]
RewriteRule ^/img/.*(png|jpg)
- [L]

RewriteRule .* index\.php [QSA,L]




For instructions on how to set custom environments please refer to the Installing eZ Publish on a Linux-UNIX based system documentation page, under "Defining the desired environment".