Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
20 posts Page 2 of 2
Okay, I will add it. Stay put.
@trendoman I'm staying put :)
have issue on live server (php7.2)
Deprecated: Non-static method CustomTags::rel() should not be called statically in /homepages/37/d766678654/htdocs/dev/elfyn/dev1/c/parser/parser.php on line 482

not sure where to put static keyword. any ideas?
One more thing.
Some of the js files have mixed case filename, the function seems to convert to all lc meaning these files don't load. Can rename all files (probably good idea) but was wondering if the need can be avoided?
I assume it'll be the same for css. etc.
cheers
gwil
[edit] doesn't seem to be a case problem. i'll investigate further; loading some js file but not others...

[edit 2] It is the case issue; just confused myself a bit
Hello there,

I rewrote the tag after your requests.
- It doesn't change case anymore
- has defer / async thing.
- I included a new check to make sure "src" file exists on disk.
- all links are output with full url, even if provided relatively (is it a good thing?).
- 'static' keyword not required anymore
@trendoman amazing! thankyou so much.

works perfectly on local machine.
on live server getting 404 error for every file, have dropped .htaccess everywhere and tried adding lines to root .htacces but to no avail. will check setup again.
maybe revert to path rather than url?
cheers
Welcome. :)
I didn't understand about 404. Okay, can you paste the link to the live server's css/js?
ok, so
http://dev.elf.magmachamber.co.uk/res/js/pf/dom4.min.js%5E3-1-2019-211556%5E.js

gives a 404 file not found
but
http://dev.elf.magmachamber.co.uk/res/js/pf/dom4.min.js

opens fine.
have put .htaccess
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On

# Rule for Versioned Static Files
RewriteRule ^(.+)\^([\d-]+)\^\.(js|css)$ $1 [L]

</IfModule>

in each folder down the tree (eg first in res, then added to js, then added to pf) and also tried adding the lines to .htaccess in root which is as follows
Code: Select all
##Tweaks##
Header set X-Frame-Options SAMEORIGIN

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
</IfModule>
## EXPIRES CACHING ##

<IfModule mod_headers.c>
    Header set Connection keep-alive
    <filesmatch "\.(ico|flv|gif|swf|eot|woff|woff2|otf|ttf|svg)$">
        # Header set Cache-Control "max-age=2592000, public"
        Header set Cache-Control "max-age=31536000, public"
    </filesmatch>
    <filesmatch "\.(jpg|jpeg|png)$">
        # Header set Cache-Control "max-age=1209600, public"
        Header set Cache-Control "max-age=31536000, public"
    </filesmatch>
    # css and js should use private for proxy caching https://developers.google.com/speed/docs/best-practices/caching#LeverageProxyCaching
    <filesmatch "\.(css)$">
        Header set Cache-Control "max-age=31536000, private"
    </filesmatch>
    <filesmatch "\.(js)$">
        Header set Cache-Control "max-age=1209600, private"
    </filesmatch>
</IfModule>

Options +SymLinksIfOwnerMatch -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On

#If your website is installed in a subfolder, change the line below to reflect the path to the subfolder.
#e.g. for http://www.example.com/subdomain1/subdomain2/ make it RewriteBase /subdomain1/subdomain2
RewriteBase /

#If you wish to use a custom 404 page, place a file named 404.php in your website's root and uncomment the line below.
#If your website is installed in a subfolder, change the line below to reflect the path to the subfolder.
#e.g. for http://www.example.com/subdomain1/subdomain2/ make it ErrorDocument 404 /subdomain1/subdomain2/404.php
ErrorDocument 404 /404.php

#If your site begins with 'www', uncomment the following two lines
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Rule for Versioned Static Files
RewriteRule ^(.+)\^([\d-]+)\^\.(js|css)$ $1 [L]


#DO NOT EDIT BELOW THIS

RewriteRule ^index.php$ "" [R=301,L,QSA]

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

....prettyURL couch generated stuff...

maybe some conflict?
will try it without cache stuff

[edit] made no difference removing cache stuff from /.htaccess
Link - this does work fine for me with .htaccess placed in /assets/.htaccess - i.e. one level above the actual file.

Please try the following - temporarily rename / delete big .htaccess from site's root and use only tag's .htaccess code in your /res/ folder then try again to open your link. If it doesn't work, then apache is not configured properly. I will not be able to fix it for you from here.
ok, tried that, no change.
seems to be an apache issue then.
strange that the prettyurl rewrite rules seem to work ok.
found a test_rewrite.zip that i downloaded from somewhere on this forum. it shows HTTP_MOD_REWRITE is not set. :?

Thanks for the rewrite, plugin works great.
i'll keep playing around and see if i can come up with anything. will post if i figure out config issue.
ok, found that adding
RewriteBase /res/js
to res/.htaccess allows me to open
http://dev.elf.magmachamber.co.uk/res/js/pf/dom4.min.js%5E3-1-2019-211556%5E.js

[edit] put.htaccess files in each of the sub-folders with RewriteBase set to the relative path of the folder it is in. works a treat.
will try to figure out why this is needed when pressure is off.
thanks again trendoman, your work & support have helped me no end.
20 posts Page 2 of 2