0% found this document useful (0 votes)
79 views3 pages

Htaccess Orignal

The document contains Apache rewrite rules and directives for caching and compressing assets to improve performance of a vBulletin forum installation. It rewrites URLs, blocks restricted directories from direct access, sets caching headers for assets, and denies access to specific file types.

Uploaded by

GGMK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views3 pages

Htaccess Orignal

The document contains Apache rewrite rules and directives for caching and compressing assets to improve performance of a vBulletin forum installation. It rewrites URLs, blocks restricted directories from direct access, sets caching headers for assets, and denies access to specific file types.

Uploaded by

GGMK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<IfModule mod_rewrite.

c>
RewriteEngine On

# In some cases where you have other mod_rewrite rules, you may need to
remove the
# comment on the following RewriteBase line and change it to match your
folder name.
# This resets the other mod_rewrite rules for just this directory
# If your site was [Link]/forum, the setting would be /forum/
#RewriteBase /

#If you used friendly urls in vB4, then uncommenting the following rules will
redirect the #
#old vB4 urls to a similar location in vB5. This is unnecesary for a new vB5
install.
#RewriteRule ^threads/.* [Link] [QSA]
#RewriteRule ^forums/.* [Link] [QSA]
#RewriteRule ^members/.* [Link] [QSA]
#RewriteRule ^blogs/.* [Link] [QSA]
#RewriteRule ^entries/.* [Link] [QSA]

#To redirect users to the secure version of your site, uncomment the lines
below
#RewriteCond %{HTTPS} !=on
#RewriteRule .* [Link] [R=301,L]

#Block directories that don't need direct access


RewriteRule
^(core/libraries/|includes|core/includes|core/vb|core/vb5|core/admincp|core/modcp)
[Link]?routestring=relay/404 [END]

#Block files and directories


RewriteRule (^|/)\.(?!well-known) [Link]?routestring=relay/404 [END]

#Block directories that don't need direct access to PHP


RewriteRule ^(css|fonts|images|js|core/cache|core/cpstyles|core/clientscript|
core/customavatars|core/images|core/store_sitemap)/.*\.php [Link]?
routestring=relay/404 [END]

# Send css calls directly to the correct file VBV-7807


RewriteRule ^[Link]$ core/[Link] [NC,L]

# Redirect old install path to core.


RewriteRule ^install/ core/install/ [NC,L]

# Main Redirect
RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ [Link]?routestring=$1 [L,QSA]
</IfModule>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/atom+xml \
text/javascript \
application/x-javascript \
application/javascript \
application/json \
application/rss+xml \
application/[Link]-fontobject \
application/x-font-ttf \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/x-javascript A1209600
ExpiresByType text/javascript A1209600
ExpiresByType application/javascript A1209600
ExpiresByType text/css A31536000
ExpiresByType image/x-icon A2592000
ExpiresByType image/icon A2592000
ExpiresByType application/x-ico A2592000
ExpiresByType application/ico A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A1209600
ExpiresByType image/jpg A1209600
ExpiresByType image/png A1209600
ExpiresByType application/x-shockwave-flash A1209600
ExpiresByType font/ttf A2592000
ExpiresByType font/otf A2592000
ExpiresByType font/x-woff A2592000
ExpiresByType image/svg+xml A2592000
ExpiresByType font/truetype A2592000
ExpiresByType font/opentype A2592000
ExpiresByType application/x-font-woff A2592000
ExpiresByType application/[Link]-fontobject A2592000
</IfModule>

<IfModule mod_headers.c>

Header set Connection keep-alive

<filesmatch "\.(ico|flv|gif|swf|eot|woff|otf|ttf|svg)$">
Header set Cache-Control "max-age=2592000, public"
</filesmatch>
<filesmatch "\.(jpg|jpeg|png)$">
Header set Cache-Control "max-age=1209600, public"
</filesmatch>
<filesmatch "\.(eot|woff|otf|ttf|svg)$">
Header set Cache-Control "max-age=2592000, public"
</filesmatch>
<filesmatch "\.(css)$">
Header set Cache-Control "max-age=31536000, public"
</filesmatch>
<filesmatch "\.(js)$">
Header set Cache-Control "max-age=1209600, public"
</filesmatch>
</IfModule>
#don't allow some files that shouldn't really be present to be directly accessed.
#note that attachements should never be directly accessed by the webserver because
#we have permissions on the that are checked in the PHP code.
<FilesMatch "(^#.*#|\.(bak|config|dist|inc|ini|log|gz|tar|zip|sh|sql|sw[op]|md)|~)
$">
Require all denied
</FilesMatch>

You might also like