• OzzModz is no longer taking registrations. All registrations are being redirected to Snog's Site
    All addons and support is available there now.

Speed Up Your Site Via htaccess

I've managed to combine their rules with all you wrote, it's fine.

The only problem is that you need to combine all rewrite rules at the end of the .htaccess file and the rules should be put before

Code:
</IfModule>
 
I've managed to combine their rules with all you wrote, it's fine.

The only problem is that you need to combine all rewrite rules at the end of the .htaccess file and the rules should be put before

Code:
</IfModule>
Sharing is caring - please feel free to post that entire .htaccess file for others future help.
 
The actual .htacces file is the last Ozzy47 example and from the line

Code:
# END Cache-Control Headers

I've combined the dBSeo example and the Ozzy rules as this:


Code:
<IfModule mod_rewrite.c>
	RewriteEngine On

	# If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
	# RewriteBase /

	# If you are having problems with the rewrite from content/ to content.php, uncomment this line to turn MultiViews off.
	# Options -MultiViews

	RewriteCond %{REQUEST_URI} !(admincp/|dbseocp/|modcp/|cron|mobiquo|forumrunner|api\.php|reviewpost/|classifieds/|photopost/)
	RewriteRule ^((archive/)?(.*\.php(/.*)?))$ dbseo.php [L,QSA]

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !/(admincp|dbseocp|modcp|clientscript|cpstyles|images|reviewpost|classifieds|photopost)/
	RewriteRule ^(.+)$ dbseo.php [L,QSA]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
    RewriteRule .* – [F,L]

    # proc/self/environ? no way!
    RewriteCond %{QUERY_STRING} proc/self/environ [OR]
    # Block out any script trying to set a mosConfig value through the URL
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
##
##  Commented version of Rewrite rules attributed to Ronald van den Heetkamp
##  Comments by http://bodvoc.com
#
# Prevent use of specified methods in HTTP Request
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
# Block out use of illegal or unsafe characters in the HTTP Request
RewriteCond %{THE_REQUEST} ^.*(r|n|%0A|%0D).* [NC,OR]
# Block out use of illegal or unsafe characters in the Referer Variable of the HTTP Request
RewriteCond %{HTTP_REFERER} ^(.*)(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
# Block out use of illegal or unsafe characters in any cookie associated with the HTTP Request
RewriteCond %{HTTP_COOKIE} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
# Block out use of illegal characters in URI or use of malformed URI
RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|">|"<|/|..).{0,9999}.* [NC,OR]
# NOTE - disable this rule if your site is integrated with Payment Gateways such as PayPal 
# Block out  use of empty User Agent Strings
RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
# Block out  use of User Agent Strings beginning with java, curl or wget
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
# Block out  use of User Agent Strings containing specific robot (crawler) identifiers
RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]
# Block out  use of User Agent Strings containing references to specific crawler libraries
RewriteCond %{HTTP_USER_AGENT} ^.*(libwww-perl|curl|wget|python|nikto|scan).* [NC,OR]
# Block out  use of illegal or unsafe characters in the User Agent variable
RewriteCond %{HTTP_USER_AGENT} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
# Measures to block out  SQL injection attacks
RewriteCond %{QUERY_STRING} ^.*(;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC,OR]
# Block out  reference to localhost/loopback/127.0.0.1 in the Query String
RewriteCond %{QUERY_STRING} ^.*(localhost|loopback|127\.0\.0\.1).* [NC,OR]
# Block out  use of illegal or unsafe characters in the Query String variable
RewriteCond %{QUERY_STRING} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC]
#
## End of commented Rewrite directives

</IfModule>

In my case there it remains a lot to be done, but I've managed to optimise a lot of things
 
I want to show some things I've managed to live with for along time and I want to know if them are worth to kept

First ip blocking

# Single IPs and ranges blocks from very persistent spammers
deny from 24.151.145.6
deny from 46.109.192.249
deny from 46.109.194.58
deny from 31.192.105.19
deny from 188.143.233.163
deny from 95.71.70.204
deny from 109.230.246.52
deny from 109.230.246.33
deny from 46.109.200.59
deny from 46.109.0.0/16
deny from 46.109.0.0/16

It's useful today?

next some pieces of Kaos proposal that have been working for a long time

Bot blocking in the .htaccess:

.......
RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget [OR]
RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus [OR]
RewriteCond %{HTTP_USER_AGENT} ^Baidu [OR]
RewriteCond %{HTTP_USER_AGENT} ^Yandex [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sosospider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bing
RewriteRule ^.* -

They are worh kept if we are using 'Ban Spiders by User Agent' mod?
 
I want to show some things I've managed to live with for along time and I want to know if them are worth to kept

First ip blocking

It's useful today?
Not really. With the ability to spoof IP addresses, today's spammer could be tomorrow's legitimate user.

Bot blocking in the .htaccess:

They are worh kept if we are using 'Ban Spiders by User Agent' mod?[/QUOTE]All depends on the list you use with the mod.
 
So i wanted to see how my forum performs with the above last .htaccess code, so i did a test with the .htaccess that was in root, and had this inside:

Code:
RewriteEngine on

RewriteEngine On
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

Result was this:
B-A-F-F-F
Screenshot by Lightshot

Now with the Ozzy .htaccess code, i got:
B-A-C-F-B
Screenshot by Lightshot

So looks like the new code works, and i still need to work on "compress images" and "compress transfer".
 
Of course it works. :) Sure there is some things that need to be manually done, but it is a good start. :)
 
Yes works wonders :tongue:

And searched for stuff related to "compress images" and "compress transfer" but nothing found yet.

My forum is new and only has few avatars and 1 banner and whatever come with vb4 install, but i want to be able to compress all
pictures automatic when someone is uploading anything to the site.

I also want to add "picture gallery" that will have watermarking option too! but only one i find with watermark
is that dragonbyte mod paid one! hmmm, nothing free.


Any clue on this? advice what you guys using?


Thanks
 
Any clue on this? advice what you guys using?


Thanks
We have a entire forum devoted to optimization workshop. Lots of real case studies there and a wealth of practical information.

But, to answer your question I let webpagetest do all my image optimization work. Keep in mind though I don't have dynamic user-uploaded images as you're dealing with, and really no idea how to auto-optimize these real-time like you seem to want.
 
Ozzy47, mod_deflate module is not on my hosting, instead there gzip_module, other modules are available. I use this code in your file htaccess?

Ozzy47, модуля mod_deflate нет на моём хостинге, вместо него есть gzip_module, остальные модули имеются. Я могу использовать этот код в своём файле htaccess?
 
All runs except these codes:

Всё работает, кроме этих кодов:

Code:
# BEGIN Compress text files
<ifModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
  AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
  AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
  AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
  AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
  AddOutputFilterByType DEFLATE font/truetype font/opentype

# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
</ifModule>
# END Compress text files

Code:
##
##  Commented version of Rewrite rules attributed to Ronald van den Heetkamp
##  Comments by http://bodvoc.com
#
# Prevent use of specified methods in HTTP Request
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
# Block out use of illegal or unsafe characters in the HTTP Request
RewriteCond %{THE_REQUEST} ^.*(r|n|%0A|%0D).* [NC,OR]
# Block out use of illegal or unsafe characters in the Referer Variable of the HTTP Request
RewriteCond %{HTTP_REFERER} ^(.*)(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
# Block out use of illegal or unsafe characters in any cookie associated with the HTTP Request
RewriteCond %{HTTP_COOKIE} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
# Block out use of illegal characters in URI or use of malformed URI
RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|">|"<|/|..).{0,9999}.* [NC,OR]
# NOTE - disable this rule if your site is integrated with Payment Gateways such as PayPal 
# Block out  use of empty User Agent Strings
RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
# Block out  use of User Agent Strings beginning with java, curl or wget
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
# Block out  use of User Agent Strings containing specific robot (crawler) identifiers
RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]
# Block out  use of User Agent Strings containing references to specific crawler libraries
RewriteCond %{HTTP_USER_AGENT} ^.*(libwww-perl|curl|wget|python|nikto|scan).* [NC,OR]
# Block out  use of illegal or unsafe characters in the User Agent variable
RewriteCond %{HTTP_USER_AGENT} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
# Measures to block out  SQL injection attacks
RewriteCond %{QUERY_STRING} ^.*(;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC,OR]
# Block out  reference to localhost/loopback/127.0.0.1 in the Query String
RewriteCond %{QUERY_STRING} ^.*(localhost|loopback|127\.0\.0\.1).* [NC,OR]
# Block out  use of illegal or unsafe characters in the Query String variable
RewriteCond %{QUERY_STRING} ^.*(<|>|'|%0A|%0D|%27|%3C|%3E|%00).* [NC]
#
## End of commented Rewrite directives
 
Hi Ozzy

I want to try this but before this can you please tell if the code below needs to be twice in the htaccess file or only once?

Code:
<IfModule mod_mime.c>
AddType text/css .css
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
AddType text/plain .txt
...
...
...
</IfModule>

Thanks

.
 
Back
Top