<IfModule mod_expires.c>

# Enable expirations
ExpiresActive On

# Default directive
ExpiresDefault "access plus 1 month"

# My favicon
ExpiresByType image/x-icon "access plus 1 month"

# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 month"
</IfModule>

Options -Indexes
SetOutputFilter DEFLATE

Options +FollowSymlinks
RewriteEngine on    # Turn on the rewriting engine

### Handle old tools url structures

RedirectMatch 301 ^/extjs/6.2/(.*)-(.*)/(.*)	/extjs/redirect.html?version=$1&toolkit=$2&class=
RedirectMatch 301 ^/extjs/6.0/(.*)-(.*)/(.*)	/extjs/redirect.html?version=$1&toolkit=$2&class=

RedirectMatch 301 ^/ext/(.*)$   /extjs/$1

### Sencha Latest Releases
RedirectMatch 301 ^/extreact/$             /extreact/latest/
RedirectMatch 301 /extreact/latest(.*)$   /extreact/6.6.0$1
RedirectMatch 301 /extjs/latest/(.*)$      /extjs/6.6.0/$1
RedirectMatch 301 /ext/latest/(.*)$        /extjs/6.5.3/$1
RedirectMatch 301 /touch/latest/(.*)$      /touch/2.4/$1
RedirectMatch 301 /themer/latest(.*)$      /themer/1.3.2/$1
RedirectMatch 301 architect/latest(.*)$   /architect/4.2$1

RedirectMatch 301 ^/extjs/(.*)/guides/$   /extjs/$1/

### Sencha Ext JS Documentation
RedirectMatch 301 /ext/?$        /extjs/6.5.3/
RedirectMatch 301 /extjs/?$      /extjs/6.6.0/
RedirectMatch 301 /ext-js/?$     /extjs/6.5.3/
RedirectMatch 301 /extjs5/?$     /extjs/5.1.3/
RedirectMatch 301 /extjs4/?$     /extjs/4.2.5/
RedirectMatch 301 /extjs3/?$     /extjs/3.4.0/

RedirectMatch 301 /ext-js/4-2(.*)$	 /extjs/4.2.5$1
RedirectMatch 301 /ext-js/4-1(.*)$	 /extjs/4.1.3$1
RedirectMatch 301 /ext-js/4-0(.*)$	 /extjs/4.0.7$1
RedirectMatch 301 /ext-js/3-4(.*)$	 /extjs/3.4.0$1
RedirectMatch 301 /ext-js/2-3(.*)$	 /extjs/2.3.0$1
RedirectMatch 301 /ext-js/1-1(.*)$	 /extjs/1.1.0$1

Redirect 301 /getting_started_premium.html  /misc/guides/getting_started_premium.html
Redirect 301 /extjs/6.2/whats_new/6.2.0/extjs_upgrade_guide.html  /extjs/6.5.3/guides/whats_new/extjs_upgrade_guide.html

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.2.0-classic/(.*) /extjs/6.2.0/classic/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.0.2-classic/(.*) /extjs/6.0.2/classic/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.0.1-classic/(.*) /extjs/6.0.1/classic/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.0.0-classic/(.*) /extjs/6.0.0/classic/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.2.0-modern/(.*) /extjs/6.2.0/modern/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.0.2-modern/(.*) /extjs/6.0.2/modern/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.0.1-modern/(.*) /extjs/6.0.1/modern/$1 [L,R=301]

RewriteCond %{REQUEST_URI} !guides.*
RewriteRule ^extjs/6.0.0-modern/(.*) /extjs/6.0.0/modern/$1 [L,R=301]

RewriteRule ^extjs/6.2.0-modern/guides/(.*) /extjs/6.2.0/guides/$1 [L,R=301]
RewriteRule ^extjs/6.0.2-modern/guides/(.*) /extjs/6.0.2/guides/$1 [L,R=301]
RewriteRule ^extjs/6.0.1-modern/guides/(.*) /extjs/6.0.1/guides/$1 [L,R=301]
RewriteRule ^extjs/6.0.0-modern/guides/(.*) /extjs/6.0.0/guides/$1 [L,R=301]

RewriteRule ^extjs/6.2.0-classic/guides/(.*) /extjs/6.2.0/guides/$1 [L,R=301]
RewriteRule ^extjs/6.0.2-classic/guides/(.*) /extjs/6.0.2/guides/$1 [L,R=301]
RewriteRule ^extjs/6.0.1-classic/guides/(.*) /extjs/6.0.1/guides/$1 [L,R=301]
RewriteRule ^extjs/6.0.0-classic/guides/(.*) /extjs/6.0.0/guides/$1 [L,R=301]

RewriteRule ^extjs/5.1/5.1.3-apidocs/ /extjs/5.1.3 [L,R=301]
RewriteRule ^extjs/5.1/5.1.2-apidocs/ /extjs/5.1.2 [L,R=301]
RewriteRule ^extjs/5.1/5.1.1-apidocs/ /extjs/5.1.1 [L,R=301]
RewriteRule ^extjs/5.1/5.1.0-apidocs/ /extjs/5.1.0 [L,R=301]

RewriteRule ^extjs/5.0/5.0.1-apidocs/ /extjs/5.0.0 [L,R=301]
RewriteRule ^extjs/5.0/5.0.0-apidocs/ /extjs/5.0.0 [L,R=301]

RewriteRule ^extjs/(.*)/classic/$       /extjs/$1/index.html [L,R=301]
RewriteRule ^extjs/(.*)/modern/$        /extjs/$1/index.html [L,R=301]

Redirect 301 http://docs-devel.sencha.com/extjs/3.4.0/index.html http://docs-devel.sencha.com/extjs/3.4.0/
Redirect 301 http://docs-devel.sencha.com/extjs/4.0.7/index.html http://docs-devel.sencha.com/extjs/4.0.7/
Redirect 301 http://docs-devel.sencha.com/extjs/4.1.3/index.html http://docs-devel.sencha.com/extjs/4.1.3/
Redirect 301 http://docs-devel.sencha.com/extjs/4.2.6/index.html http://docs-devel.sencha.com/extjs/4.2.6/
Redirect 301 http://docs.sencha.com/extjs/3.4.0/index.html       http://docs.sencha.com/extjs/3.4.0/
Redirect 301 http://docs.sencha.com/extjs/4.0.7/index.html       http://docs.sencha.com/extjs/4.0.7/
Redirect 301 http://docs.sencha.com/extjs/4.1.3/index.html       http://docs.sencha.com/extjs/4.1.3/
Redirect 301 http://docs.sencha.com/extjs/4.2.6/index.html       http://docs.sencha.com/extjs/4.2.6/

### Sencha GXT Documentation
RedirectMatch 301 /gxt/3.1.0-beta(.*)$           /gxt/4.x$1
#RedirectMatch 301 /gxt/?$               /gxt/4.x$1
RedirectMatch 301 /extgwt/?$            http://www.sencha.com/gxtdocs/
RedirectMatch 302 /gxt/latest(.*)$	    /gxt/4.x$1
RedirectMatch 301 /gxt/3.1?$            /gxt/3.x$1
RedirectMatch 301 /gxt/3.1/?$           /gxt/3.x/$1
Redirect 301 /gxt/5.0.0-EA1/getting_started/Getting_Started.html /gxt/5.x/guides/getting_started/getting_started.html
RedirectMatch 301 /gxt/5.0.0-EA1(.*)$   /gxt/5.x$1
Redirect 301 /gxt/3.1.0-beta/javadoc/index.html   /gxt/3.x/javadoc/gxt-3.1.4/index.html
Redirect 301 /gxt/announcements/release_notes.html    /gxt/latest/announcements/release_notes.html
RedirectMatch 301  ^/gxt/$              /gxt/4.x/
RedirectMatch 301  ^/gxt/4.0.0(.*) /gxt/4.x/guides$1
RedirectMatch 301  ^/gxt/4.0.1(.*) /gxt/4.x/guides$1
RedirectMatch 301  ^/gxt/4.0.2(.*) /gxt/4.x/guides$1
RedirectMatch 301  ^/gxt/3.1.4(.*) /gxt/3.x/guides$1
RedirectMatch 301  ^/gxt/(.*)/guides/$   /gxt/$1/

### Cmd
RedirectMatch 301 /cmd/?$                /cmd/6.6.0/
RedirectMatch 301 /cmd/latest/(.*)$      /cmd/6.6.0/$1
#RedirectMatch 301 ^/cmd/6.x/    /cmd
RedirectMatch 301 ^/cmd/5.x/    /cmd

Redirect 301 http://docs-devel.sencha.com/touch/2.0/index.html /touch/2.0.2/
Redirect 301 http://docs-devel.sencha.com/touch/2.1/index.html /touch/2.1.1/
Redirect 301 http://docs-devel.sencha.com/touch/2.2/index.html /touch/2.2.1/
Redirect 301 http://docs-devel.sencha.com/touch/2.3/index.html /touch/2.3.1/
Redirect 301 http://docs.sencha.com/touch/2.0/index.html /touch/2.0.2/
Redirect 301 http://docs.sencha.com/touch/2.1/index.html /touch/2.1.1/
Redirect 301 http://docs.sencha.com/touch/2.2/index.html /touch/2.2.1/
Redirect 301 http://docs.sencha.com/touch/2.3/index.html /touch/2.3.1/

## Sencha Touch Charts Documentation
RedirectMatch 301 /touch-charts/?$         /touch-charts/1.0.1/
RedirectMatch 301 /touch-charts/1-0(.*)$   /touch-charts/1.0.1$1

## Inspector
Redirect 301 /tools/sencha_inspector/inspecting_desktop_applications.html /sencha_inspector/guides/inspecting_desktop_applications.html
Redirect 301 /tools/sencha_inspector/inspecting_mobile_applications.html  /sencha_inspector/guides/inspecting_mobile_applications.html
Redirect 301 /tools/sencha_inspector/index.html /sencha_inspector/index.html

### Sencha Themer
RedirectMatch 301 ^/themer/$                             /themer/1.3.0/index.html

### Sencha Test
RedirectMatch 301 ^/sencha_test/$                        /sencha_test/2.2.0/index.html
RedirectMatch 301 ^/sencha_test/index.html$              /sencha_test/2.2.0/index.html
RedirectMatch 301 ^/sencha_test/apidocs/$                /sencha_test/2.2.0/index.html
RedirectMatch 301 ^/sencha_test/apidocs/source(.*)$      /sencha_test/2.2.0/src$1
RedirectMatch 301 ^/sencha_test/apidocs/$                /sencha_test/2.2.0/index.html

# IDEs
Redirect 301 /ide_plugins/visual_studio_ide_plugin.html /ide_plugins/guides/visual_studio_ide_plugin.html
Redirect 301 /ide_plugins/eclipse_ide_plugin.html       /ide_plugins/guides/eclipse_ide_plugin.html
Redirect 301 /ide_plugins/jetbrains_ide_plugin.html     /ide_plugins/guides/jetbrains_ide_plugin.html

### Architect
RedirectMatch 301 ^/architect/$  /architect/4.2/$1
RedirectMatch 301 ^/architect/index.html$ /architect/4/index.html
RedirectMatch 301 ^/architect/guides(.*)$ /architect/4/guides$1
RedirectMatch 301 ^/architect/3.5/$  /architect/3/$1
RedirectMatch 301 ^/architect/3/getting_started/installation_setup.html$  /architect/3/guides/getting_started/installation_setup.html
RedirectMatch 301 ^/architect/3/tutorials/responsive_dashboard.html$  /architect/3/guides/tutorials/responsive_dashboard.html
RedirectMatch 301 ^/architect/3/tutorials/first_mobile_application.html$  /architect/3/guides/tutorials/first_mobile_application.html
RedirectMatch 301 ^/architect/3/getting_started/installation_setup.html$  /architect/3/guides/getting_started/installation_setup.html
RedirectMatch 301 ^/architect/3/reference/change_log.html$  /architect/3/guides/reference/change_log.html
RedirectMatch 301 ^/architect/3.5/(.*).html$  /architect/3/guides/$1.html
