+ Reply to Thread
Results 1 to 3 of 3

Thread: Htacess - Pageseed

  1. #1

    Htacess - Pageseed

    P.S. correction to typo error in title : PageSpeed

    Ran Google pagespeed test and got 65/100 .So want to add/install pagespeed on Ubuntu 14.04 try rather than use Flynax .htaccess

    .......
    # Block possible mySQL injections
    RewriteCond %{REQUEST_METHOD} ^(PUT|CONNECT|HEAD|TRACE|TRACK) [NC,OR]
    RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]
    RewriteCond %{HTTP_REFERER} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
    RewriteCond %{HTTP_COOKIE} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
    RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|">|"<|/|\\\.\.\\).{0,9999} [NC,OR]
    RewriteCond %{QUERY_STRING} (;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|updat e|md5|benchmark) [NC,OR]
    RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]
    RewriteCond %{QUERY_STRING} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC]
    # Note: The final RewriteCond must NOT use the [OR] flag.

    # Return 403 Forbidden error.
    RewriteRule .* index.php [F]

    # set files headers
    # <IfModule mod_headers.c>
    # <FilesMatch "\.(png|gif|jpg|jpeg)$">
    # Header set Cache-Control "max-age=5356800, public, must-revalidate"
    # </FilesMatch>

    # <FilesMatch "\.(css|js)$">
    # Header set Cache-Control "max-age=2678400, public, must-revalidate"
    # </FilesMatch>
    # <FilesMatch "\.(js|css|xml|gz)$">
    # Header append Vary: Accept-Encoding
    # </FilesMatch>
    # Header append Connection keep-alive
    # <FilesMatch ".(eot|ttf|otf|woff)">
    # Header set Access-Control-Allow-Origin "*"
    # </FilesMatch>
    # </IfModule>

    # deflate static content
    # <IfModule mod_deflate.c>
    # AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/x-component text/css application/x-javascript application/javascript
    # </IfModule>

    # http://httpd.apache.org/docs/2.2/mod/mod_expires.html
    # <ifmodule mod_expires.c>
    # <filesmatch ".(css|js|png|gif|jpg|jpeg|htc)$">
    # ExpiresActive on
    # ExpiresDefault "access plus 1 year"
    # </filesmatch>
    # </ifmodule>

    # allow request methods
    <Limit POST PUT DELETE GET OPTIONS HEAD>
    Order deny,allow
    Allow from All
    </Limit>

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} ^/templates
    RewriteRule templates\/(.*?\/)(.*)$ templates/template_core/$2 [L]

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [L]

    ErrorDocument 404 /404.html

    # non .html redirect
    #RewriteCond %{REQUEST_URI} !(\.[a-z]+)$ [NC]
    #RewriteRule ^([^\/]{3,})/$ http://%{HTTP_HOST}/$1.html [NC,L,R=301]

    # non trailing redirect
    #RewriteCond %{REQUEST_URI} !(\.[a-z]+|[\/]|\?.+)$ [NC]
    RewriteCond %{REQUEST_URI} !(\.[a-z]+|[\/])$ [NC]
    RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI}/ [NC,L,R=301]

    # define system languages
    #RewriteRule ^([a-zA-Z]{2})$ index.php?page=$1 [QSA,L]

    # define paging
    RewriteRule ^([^//]+)/?(.*)?/index([0-9]*).html$ index.php?page=$1&rlVareables=$2&pg=$3 [QSA,L]

    # define listing
    #RewriteRule ^(([\w\-\_]+)?/)([^/]+)(/.+)-l?([0-9]+).html$ index.php?page=$2&rlVareables=$3$4&listing_id=$5 [QSA,L]
    RewriteRule ^([^/]+)(/?(.{2,}))?-l?([0-9]+).html$ index.php?page=$1&rlVareables=$3&listing_id=$4 [QSA,L]


    # wildcard request
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d [OR]
    RewriteCond %{REQUEST_URI} ^\/
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTP_HOST} !^m\. [NC]
    #RewriteCond %{HTTP_HOST} \.{2,} [NC] # 1 is localhost usage, 2 is glabal usage
    RewriteCond %{HTTP_HOST} ^([^\.]+)\..+\.+ [NC]
    RewriteCond %{HTTP_HOST} ^([^\.]+) [NC]
    RewriteRule (.*) index.php?page=%1&wildcard&rlVareables=$1 [QSA,L]

    # account request (sub-directory)
    RewriteRule ^((\w{2})/)?([\w-_]{3,})$ index.php?page=$3&lang=$2&account_request [QSA,L]

    # define single pages
    RewriteRule ^([^//]+)/?(^/*)?.html$ index.php?page=$1 [QSA,L]

    # define other pages
    RewriteRule ^([^//]+)/?(.*)?/?(.*)?(.html|/+)$ index.php?page=$1&rlVareables=$2 [QSA,L]

    # Google and Yahoo sitemap
    RewriteRule ^([a-z_]*)?sitemap([0-9]*).xml$ plugins/sitemap/sitemap.php?search=google&number=$2&mod=$1 [QSA,L]
    RewriteRule ^yahoo-sitemap.txt$ /plugins/sitemap/sitemap.php?search=yahoo [QSA,L]
    RewriteRule ^urllist.txt$ /plugins/sitemap/sitemap.php?search=urllist [QSA,L]
    Did I comment out the right blocks to test pagespeed ?

    Kind Regards
    Last edited by Nizam Karim; May 22, 2017 at 04:05 PM.

  2. #2
    Hello Nizam,

    What is url to Ubuntu pagespeed.
    I think you should add 1 new rule for your new page.
    Viktor,
    Flynax technical department,
    Best wishes.

  3. #3
    Hi Mr Victor

    Using Ubuntu 14.04 /w Nginx reverse proxy
    on light Control Panel Severpilot which has supports Pagespeed
    https://serverpilot.io/community/art...pagespeed.html

    Pagespeed install from source documentation
    https://modpagespeed.com/doc/build_n...ed_from_source

    Kind Regards

+ Reply to Thread