<IfModule mod_rewrite.c>
 RewriteEngine Off
</IfModule>

<IfModule mod_headers.c>
 <FilesMatch "\.(gif|jpg|png|css|swf|php)$">
  Header add "Expires" "Mon, 28 Jul 2014 23:30:00 GMT"
  Header add "Cache-Control" "max-age=31536000"
 </FilesMatch>
</IfModule>

<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault A604800
 ExpiresByType text/css A604800
 ExpiresByType image/gif A604800
 ExpiresByType image/png A604800
 ExpiresByType image/jpeg A604800
 ExpiresByType application/x-shockwave-flash A604800
</IfModule>

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*)/desktop/(.*)/? [NC]
RewriteRule .* %1/extensions/desktop/%2 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*)/mobile/(.*)/? [NC]
RewriteRule .* %1/extensions/mobile/%2 

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to cometchat!

# Block out any < > tag in URL.
RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR]
# Block out any script that includes a javascript: in URL.
RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (\;|\'|\"|%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR]
# Block out any script that includes a base64_encode() in URL.
RewriteCond %{QUERY_STRING} (base64_encode|mosconfig) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL or trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC]
RewriteCond %{QUERY_STRING} (boot\.ini|echo.*kae|etc/passwd) [NC,OR]
# Return 403 Forbidden header
RewriteRule .* - [F]
#
## End - Rewrite rules to block out some common exploits.