OllieMackJames
Members-
Posts
356 -
Joined
-
Last visited
Everything posted by OllieMackJames
-
How to make sure PW loads https in overlays
OllieMackJames replied to OllieMackJames's topic in General Support
Thanks arjen, this did the trick, turned out couple of templates were set to http only, after I changed that tot http or https, problem was gone, so thanks again! cstevensjr, thanks for your thoughts, I had already tried that, should have said so, but all works now, thanks! -
I have a site that uses masonry style loading of summaries (with image) of underlying pages. Whenever one image is clicked, the underlying full page is loaded in an overlay through javascript. This all works great on http, the page is loaded fine in the overlay, but on https it does not work. Chrome shows this: Main origin green dot https://www.site.com Non-Secure Origins red cross http://www.site.com Apparently processwire automatically feeds http, and since this is unsecure, it is not shown. So here is the question: How can I get/force processwire to load https? Thanks!
-
Thanks ottogal, that one also works, much appreciated.
-
This is the one! Added the 2 lines to my config.php and added this: <title><?php echo $page->get("seo_title|title") . $config->prefix_title_separator . $config->prefix_sitename; ?></title> Works like a charm, thanks fbg13!
-
HI szabesz, thanks, <?php echo parse_url($page->httpURL,PHP_URL_HOST); ?> gives me the www variant as well. Just now saw the reply from fbg13, which gives me exactly what I need, thanks!
-
Thanks ottogal, taht is one step forward, it now shows www.domainnam.com - I want just Domainname.com
-
Thanks Alxndre', I need one stepmore, cause this adds the Url as in like: https://www.domainname.com I have now done it like this: <title><?php echo $page->get("seo_title|title"); ?> | Domainname.com</title> I think this will work for me, I hardly ever do any of this html coding, hence the noob question. Once again Alxndr' thanks for thinking along!
-
How can I add the domain name to the end of this: <title><?php echo $page->get("seo_title|title"); ?></title> par example: seo_title = Wonderful Catchy Thingies then the ouput will be: <title>Wonderful Catchy Thingies</title> And I want it to be: <title>Wonderful Catchy Thingies | Mydomainname.com</title> Thanks!
-
Thanks Martijn, will give a try on next domain that needs porting!
-
Hey arjen, Thanks for that, I did exactly that on another site and it worked fine. On this particular site it seems some code is blocking this, I have now asked the developer to look at that. Thanks again!
-
I am porting a site from http to https, I use pw 2.7.3 with procache On the command line I copied all from public_html to private_html Trouble is that the https homepage keeps redirecting to http homepage, i.e. https://www.domain.com redirects to http://www.domain.com That problem does not exist when I load a page off root, like https://www.domain.dom/one-down does not redirect. Here is my htaccess file for the private_html dir: ################################################################################################# # ProcessWire ProCache recommended .htaccess tweaks for expires and gzip performance settings. # PWPC-3.0 Keep this line here for ProCache identification purposes. ################################################################################################# <IfModule mod_headers.c> Header set Connection keep-alive Header unset ETag <FilesMatch "\.(eot|otf|ttc|ttf|woff)$"> Header set Access-Control-Allow-Origin "*" </FilesMatch> </IfModule> FileETag None <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 month" # html ExpiresByType text/html "access plus 1 hour" # images ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType image/bmp "access plus 1 year" ExpiresByType image/webp "access plus 1 year" # css and js ExpiresByType text/css "access plus 1 year" ExpiresByType text/javascript "access plus 1 year" ExpiresByType application/javascript "access plus 1 year" ExpiresByType application/x-javascript "access plus 1 year" # downloads ExpiresByType application/octet-stream "access plus 1 year" # feeds ExpiresByType application/json "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType text/xml "access plus 0 seconds" # icon / favicon ExpiresByType image/vnd.microsoft.icon "access plus 1 year" ExpiresByType image/x-icon "access plus 1 year" # font ExpiresByType application/x-font-ttf "access plus 1 year" ExpiresByType application/x-font-woff "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" ExpiresByType application/font-woff2 "access plus 1 year" ExpiresByType font/woff "access plus 1 year" ExpiresByType application/vnd.ms-fontobject "access plus 1 year" ExpiresByType font/eot "access plus 1 year" ExpiresByType font/opentype "access plus 1 year" # audio/video ExpiresByType audio/ogg "access plus 1 month" ExpiresByType video/mp4 "access plus 1 month" ExpiresByType video/ogg "access plus 1 month" ExpiresByType video/webm "access plus 1 month" </IfModule> <IfModule mod_deflate.c> <IfModule mod_setenvif.c> <IfModule mod_headers.c> # Force compression for mangled `Accept-Encoding` request headers # https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding </IfModule> </IfModule> # <IfModule mod_filter.c> # Apache 2.3.7 and above may need to uncomment this line AddOutputFilterByType DEFLATE "text/html" AddOutputFilterByType DEFLATE "text/plain" AddOutputFilterByType DEFLATE "text/css" AddOutputFilterByType DEFLATE "text/javascript" AddOutputFilterByType DEFLATE "application/javascript" AddOutputFilterByType DEFLATE "application/x-javascript" AddOutputFilterByType DEFLATE "application/json" AddOutputFilterByType DEFLATE "application/xml" AddOutputFilterByType DEFLATE "text/xml" # </IfModule> # Apache 2.3.7 and above may need to uncomment this line </IfModule> # End ProcessWire ProCache recommended tweaks ################################################################################################# ################################################################################################# # START PROCESSWIRE HTACCESS DIRECTIVES # @version 2.5 # @indexVersion 250 ################################################################################################# # ----------------------------------------------------------------------------------------------- # Don't show directory indexes, but do follow symbolic links # 500 NOTE: Some cloud hosting companies don't allow +FollowSymLinks. # Uncomment +SymLinksifOwnerMatch and comment +FollowSymLinks if you have 500 errors. # If that doesn't resolve the error, then set it back to +FollowSymLinks. # ----------------------------------------------------------------------------------------------- Options -Indexes Options +FollowSymLinks # Options +SymLinksifOwnerMatch # ----------------------------------------------------------------------------------------------- # Let ProcessWire handle 404s # ----------------------------------------------------------------------------------------------- ErrorDocument 404 /index.php # ----------------------------------------------------------------------------------------------- # Handle request for missing favicon.ico/robots.txt files (no ending quote for Apache 1.3) # ----------------------------------------------------------------------------------------------- <Files favicon.ico> ErrorDocument 404 "The requested file favicon.ico was not found. </Files> <Files robots.txt> ErrorDocument 404 "The requested file robots.txt was not found. </Files> # ----------------------------------------------------------------------------------------------- # Protect from XSS with Apache headers # ----------------------------------------------------------------------------------------------- <IfModule mod_headers.c> # prevent site from being loaded in an iframe on another site # you will need to remove this one if you want to allow external iframes Header always append X-Frame-Options SAMEORIGIN # to prevent cross site scripting (IE8+ proprietary) Header set X-XSS-Protection "1; mode=block" # prevent mime-based attacks via content sniffing (IE+Chrome) # Header set X-Content-Type-Options "nosniff" </IfModule> # ----------------------------------------------------------------------------------------------- # Protect ProcessWire system files (part 1B) for Apache versions 2.4 and newer: # APACHE 2.4+ NOTE: Uncomment this section and remove or comment out section 1A above. # ----------------------------------------------------------------------------------------------- <FilesMatch "\.(inc|info|info\.json|module|sh|sql)$|^(\..*)$"> Require all denied </FilesMatch> <Files .htaccess> Require all denied </Files> # ----------------------------------------------------------------------------------------------- # Override a few PHP settings that can't be changed at runtime (not required) # 500 NOTE: Try commenting out this entire section below if getting Apache 500 errors. # ----------------------------------------------------------------------------------------------- <IfModule mod_php5.c> php_flag magic_quotes_gpc off php_flag magic_quotes_sybase off php_flag register_globals off </IfModule> # ----------------------------------------------------------------------------------------------- # Set default directory index files # ----------------------------------------------------------------------------------------------- DirectoryIndex index.php index.html index.htm # ----------------------------------------------------------------------------------------------- # ProcessWire requires mod_rewrite # ----------------------------------------------------------------------------------------------- <IfModule mod_rewrite.c> RewriteEngine On AddDefaultCharset UTF-8 # ----------------------------------------------------------------------------------------------- # If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below. # ----------------------------------------------------------------------------------------------- #RewriteCond %{HTTPS} off #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] #RewriteCond %{HTTPS} !=on # This checks to make sure the connection is not already HTTPS #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ----------------------------------------------------------------------------------------------- # Set an environment variable so the installer can detect that mod_rewrite is active. # Note that some web hosts don't support this. If you get a 500 error, you might try # commenting out this SetEnv line below. # ----------------------------------------------------------------------------------------------- <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE On </IfModule> # ----------------------------------------------------------------------------------------------- # OPTIONAL: Set a rewrite base if rewrites aren't working properly on your server. # And if your site directory starts with a "~" you will most likely have to use this. # ----------------------------------------------------------------------------------------------- # RewriteBase / # RewriteBase /pw/ # RewriteBase /~user/ # ----------------------------------------------------------------------------------------------- # Access Restrictions: Keep web users out of dirs that begin with a period # ----------------------------------------------------------------------------------------------- RewriteRule "(^|/)\." - [F] # ----------------------------------------------------------------------------------------------- # OPTIONAL: Redirect users to the 'www.' version of the site (uncomment to enable). # For example: http://processwire.com/ would be redirected to http://www.processwire.com/ # ----------------------------------------------------------------------------------------------- RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ----------------------------------------------------------------------------------------------- # OPTIONAL: Send URLs with non name-format characters to 404 page # Remove this section if it interferes with URLs of any other software you may be running. # ----------------------------------------------------------------------------------------------- RewriteCond %{REQUEST_URI} "[^-_.a-zA-Z0-9/~]" RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?it=/http404/ [L,QSA] # ----------------------------------------------------------------------------------------------- # Access Restrictions: Protect ProcessWire system files # ----------------------------------------------------------------------------------------------- # Allow screenshot files (for install.php only: this 1 line below may be removed after install) RewriteCond %{REQUEST_URI} !(^|/)site-[^/]+/install/[^/]+\.(jpg|jpeg|png|gif)$ # Block access to any htaccess files RewriteCond %{REQUEST_URI} (^|/)\.htaccess$ [NC,OR] # Block access to protected assets directories RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) [OR] # Block acceess to the /site/install/ directory RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/install($|/.*$) [OR] # Block dirs in /site/assets/ dirs that start with a hyphen RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/assets.*/-.+/.* [OR] # Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php RewriteCond %{REQUEST_URI} (^|/)(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ [OR] # Block access to any PHP-based files in /templates-admin/ RewriteCond %{REQUEST_URI} (^|/)(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ [OR] # Block access to any PHP or markup files in /site/templates/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ [OR] # Block access to any PHP files in /site/assets/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/assets($|/|/.*\.php)$ [OR] # Block access to any PHP files in core or core module directories RewriteCond %{REQUEST_URI} (^|/)wire/(core|modules)/.*\.(php|inc|tpl|module|info\.json)$ [OR] # Block access to any PHP files in /site/modules/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module|info\.json)$ [OR] # Block access to any software identifying txt files RewriteCond %{REQUEST_URI} (^|/)(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md|textile)$ [OR] # Block all http access to the default/uninstalled site-default directory RewriteCond %{REQUEST_URI} (^|/)site-default/ # If any conditions above match, isssue a 403 forbidden RewriteRule ^.*$ - [F,L] # ----------------------------------------------------------------------------------------------- # Ensure that the URL follows the name-format specification required by ProcessWire # ----------------------------------------------------------------------------------------------- RewriteCond %{REQUEST_URI} "^/~?[-_.a-zA-Z0-9/]*$" # PROCACHE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{QUERY_STRING} !.*=.* RewriteCond %{HTTP_COOKIE} !^.*(wire_challenge).*$ RewriteCond %{DOCUMENT_ROOT}/site/assets/ProCache-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/$1/index.html -f RewriteRule ^(.*) %{DOCUMENT_ROOT}/site/assets/ProCache-xxxxxxxxxxxxxxxxxxxxxxxxxx/$1/index.html [L] # /PROCACHE RewriteCond %{REQUEST_URI} "^/~?[-_.a-zA-Z0-9/]*$" # ----------------------------------------------------------------------------------------------- # If the request is for a file or directory that physically exists on the server, # then don't give control to ProcessWire, and instead load the file # ----------------------------------------------------------------------------------------------- RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !(favicon\.ico|robots\.txt) # ----------------------------------------------------------------------------------------------- # OPTIONAL: Prevent ProcessWire from attempting to serve images or anything in /site/assets/. # Both of these lines are optional, but can help to reduce server load. However, they # are not compatible with the $config->pagefileSecure option (if enabled) and they # may produce an Apache 404 rather than your regular 404. You may uncomment the two lines # below if you don't need to use the $config->pagefileSecure option. # ----------------------------------------------------------------------------------------------- # RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|ico)$ [NC] # RewriteCond %{REQUEST_FILENAME} !(^|/)site/assets/ # ----------------------------------------------------------------------------------------------- # Pass control to ProcessWire if all the above directives allow us to this point. # For regular VirtualHosts (most installs) # ----------------------------------------------------------------------------------------------- RewriteRule ^(.*)$ index.php?it=$1 [L,QSA] # ----------------------------------------------------------------------------------------------- # 500 NOTE: If using VirtualDocumentRoot: comment out the one above and use this one instead. # ----------------------------------------------------------------------------------------------- # RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA] </IfModule> ################################################################################################# # END PROCESSWIRE HTACCESS DIRECTIVES ################################################################################################# Help much appreciated, if someone has a checklist for porting http to https that would be great!
-
@Mike Rockett thanks, just seeing this and tested the fix, all works fine again! @David Karich thanks as well, much appreciated! The power of a great community shows again.
-
Hi Mike, took a while to log in here again. I work with php 7.0.8 When I you navigate to /pwire/setup/jumplinks/entity/?id=19, I see the Register New Jumplink page, and this URL: /pwire/setup/jumplinks/entity/?id=19 Thanks for looking into it!
-
Hi Mike, When I hover I see stuff like this in status bar: http://www.site.com/pwire/setup/jumplinks/entity/?id=19 When I manually go to http://www.site.com/pwire/setup/jumplinks/entity/?id=1 I get to the page: Admin > Setup > Jumplinks > Register New Jumplink Thanks!
-
I am on pw 2.7.3 and have jumplinks 1.5.2 I can not delete any jumplink, when I click on the source I just get taken to the add new jumplink page. Would be nice if this could be fixed. Thanks
-
@SteveB thanks, admin side now worked, frontend threw other errors, having to do with undefined wire function somewhere. Will check further tomorrow.
-
Glad I could easily revert to older version Thanks lots Ryan for making that easy!
-
After upgrade I got this message: Parse Error: syntax error, unexpected '/' (line 112 of /xxxx/domains/xxxx.com/public_html/site/modules/ServicePages/ServicePages.module) Refreshed many times without luck, any ideas? tnks!
-
@horst, thanks! I can use PW3 so that should be ok. My son wrote the following code - we just tested this code standalone in a separate directory, and it works fine: <?php echo "starting - wait until you see the end message"; require_once 'src/optimus.php'; /** ------- Configuration variables for script: ------- */ $inputParentBaseDir = '../site/assets/files'; //base directory for non optimized images $outputParentBaseDir = '../site/assets/optimized'; //output directory for optimized images $imageFileExtensions = Array('jpeg', 'jpg', 'png'); $optimus = new Optimus('<Your Optimus Key here>'); /** --------------------------------------------------- */ /** Goes through all files in the main directory and all subdirectories and compresses the image files: */ $subDirectoryIterator = new RecursiveDirectoryIterator($inputParentBaseDir); $imagesOptimized = 0; $imagesSkipped = 0; foreach (new RecursiveIteratorIterator($subDirectoryIterator) as $fileName => $file) { /** Checks if the file is an image file: */ if (in_array(get_file_extension($fileName), $imageFileExtensions)) { /** Checks if an optimized version of the image file does not exist yet: */ $optimizedImagePath = str_replace_first_occurance($fileName, $inputParentBaseDir, $outputParentBaseDir); //echo 'Found an image file: ' . $fileName . '. Optimized path = ' . $optimizedImagePath . '<br>'; if (!file_exists($optimizedImagePath)) { if(!file_exists(dirname($optimizedImagePath))) mkdir(dirname($optimizedImagePath), 0777, true); /** Optimizes the image and stores the result in a different location: */ $optimizedImage = $optimus->optimize($fileName); file_put_contents($optimizedImagePath, $optimizedImage); $imagesOptimized++; } else $imagesSkipped++; } } echo 'Optimized ' . $imagesOptimized . ' images. Skipped ' . $imagesSkipped . ' images since they were already optimized.<br>'; function str_replace_first_occurance($haystack, $needle, $replace) { $pos = strpos($haystack, $needle); if ($pos !== false) return substr_replace($haystack, $replace, $pos, strlen($needle)); throw new Exception($needle . ' could not be found in ' . $haystack . '.'); } function get_file_extension($fileName) { $fileNameAsArray = explode('.', $fileName); return strtolower(array_pop($fileNameAsArray)); //gets the last part of the array (the extension) and returns it as lower case } ?> We tested this standalone on my server and it nicely compressed all images into the optimized directory, with all subdirectories. If anyone can tell me how to turn this into a module, that would be great. Of course now I need to figure out how to get PW to pull images from the /site/assets/optimized directories Anyone any ideas how to take this one step further. BTW, i now have all compressed and optimized images on the server in the directory /site/assets/optimized Lots of subdirectories and much smaller files. Thanks for the input so far! Further help much appreciated!
-
Thanks for chiming in LostKobrakai, looking forward to info on how to hook etc!
-
I want to use optimus.io api for image compression. I am looking for some help for the following: I use thumbnails module from apeisa which still works fine, thanks again apeisa!!! After processwire does it's magic I end up with all image files in all sorts of different directories in /site/assets/files And these I want to compress... Optimus gives me the following php code to use to compress an image: <?php /** * PHP Test Client for the Optimus API * * optimus.io - Lossless compression and optimization of your images * * @author KeyCDN * @version 0.1 */ // load optimus lib require 'src/optimus.php'; // create object and pass API license key $optimus = new Optimus('<your_license_key>'); // optimize image $result = $optimus->optimize('img/102kb.jpg'); // save optimized image file_put_contents('opt/102kb.jpg', $result); What I would like help on is the following: How can I get something like the following coded: (I am not a coder, just guessing stuff) for each subdirectory in /site/assets/files get list of images then for each image in list $optimus = new Optimus('<your_license_key>'); // optimize image $result = $optimus->optimize('location/name.jpg'); // save optimized image file_put_contents('location/name.jpg', $result); Of course this will just overwrite the files, but I have no idea to do this otherwise so if anybody has a brilliant idea for that as well, that would even be better. What I can think of is: for each directory in /site/assets/files that does not have a subdirectory called optimized get list of images from subdirectory and subdirectory/optimized then for each image in list that does not already have an optimized version $optimus = new Optimus('<your_license_key>'); // optimize image $result = $optimus->optimize('location/name.jpg'); // save optimized image file_put_contents('optimized/name.jpg', $result); In this case optimized images get saved in a new directory, and optimization only takes place when optimized subdirectory does not exist already and image is not already optimized. Now I would need to on the fly change the location of all images in templates to have the /optimized/ subdirectory appended to the file url. All this together would then be a new module for lossless image compression using optimus.io So if anyone can help me forward, thanks!
-
I ran into Optimus API for lossless image compression. They seem to have a very good compression algo, google pagespeed does not show anymore compression of images. ALso the pricing seems to be good, for all own projects it is only 19$ per year, and for developers it is 99$ for all customer projects. They have a php library that connects with the API https://github.com/keycdn/php-optimus-api AFAIK it allows local execution and local storage if compressed images. Anybody know how to integrate this with Processwire?
-
Crowdfunded Tinypng Integration Module
OllieMackJames replied to OllieMackJames's topic in Module/Plugin Development
@horst by this I mean image compression - preferably local on server Don't know if this makes it clearer, as I am mainly focused on website speed results for usability reasons and for seo reasons. thks -
Crowdfunded Tinypng Integration Module
OllieMackJames replied to OllieMackJames's topic in Module/Plugin Development
Thanks all for your thoughts, we only raised 200$, and no one offered to code it since I am not a coder, only a very happy user of the great processwire cms I guess this will not happen - at least not now. @horst question for you, could you perhaps include this in your great module croppable image? Great discussion on the technical side of things, thanks for that!