Wordpress Notes: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 45: Line 45:
     }
     }
}
}
</pre>
sample file layout:
<pre>
├── composer.json
├── composer.lock
├── public_html
│   ├── report
│   ├── wp
│   │   ├── composer.json
│   │   ├── db
│   │   ├── index.php
│   │   ├── license.txt
│   │   ├── readme.html
│   │   ├── wp-activate.php
│   │   ├── wp-admin
│   │   ├── wp-blog-header.php
│   │   ├── wp-comments-post.php
│   │   ├── wp-config.php
│   │   ├── wp-config-sample.php
│   │   ├── wp-content
│   │   ├── wp-cron.php
│   │   ├── wp-includes
│   │   ├── wp-links-opml.php
│   │   ├── wp-load.php
│   │   ├── wp-login.php
│   │   ├── wp-mail.php
│   │   ├── wp-settings.php
│   │   ├── wp-signup.php
│   │   ├── wp-trackback.php
│   │   └── xmlrpc.php
└── vendor
    ├── autoload.php
    ├── bin
    │   ├── php-parse -> ../nikic/php-parser/bin/php-parse
    │   ├── psysh -> ../psy/psysh/bin/psysh
    │   └── wp -> /var/www/site.ca-v0.0.1/vendor/wp-cli/wp-cli
    ├── composer
    │   ├── autoload_classmap.php
    │   ├── autoload_files.php
    │   ├── autoload_namespaces.php
    │   ├── autoload_psr4.php
    │   ├── autoload_real.php
    │   ├── ClassLoader.php
    │   ├── installed.json
    │   ├── installers
    │   └── LICENSE
    ├── dnoegel
    │   └── php-xdg-base-dir
    ├── jakub-onderka
    │   ├── php-console-color
    │   └── php-console-highlighter
    ├── johnpbloch
    │   ├── wordpress
    │   └── wordpress-core-installer
    ├── nikic
    │   └── php-parser
    ├── philippbaschke
    │   └── acf-pro-installer
    ├── psr
    │   └── log
    ├── psy
    │   └── psysh
    ├── symfony
    │   ├── console
    │   ├── debug
    │   ├── polyfill-mbstring
    │   ├── process
    │   └── var-dumper
    ├── vlucas
    │   └── phpdotenv
    └── wp-cli
        └── wp-cli
</pre>
apache config:
<pre>
Listen 8080
<VirtualHost *:8080>
  ## Vhost docroot
  # DocumentRoot "/var/www/site.ca/public_html"
  DocumentRoot "/var/www/www.site.ca/public_html"
  ## Directories, there should at least be a declaration for /var/www/site.ca/public_html
  <Directory "/var/www/www-dev.sys.site.ca">
      Options -Indexes +MultiViews +FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>
SetEnvIf x-forwarded-proto https HTTPS=on
    ## Logging
  ErrorLog "/var/log/apache2/site.ca_8080_error.log"
  ServerSignature Off
  CustomLog "/var/log/apache2/site.ca_8080_access.log" combined
</VirtualHost>
</pre>
plain web behind https LB, in wp-config.php
<pre>
// Amazon AWS Elastic Load Balancer, CloudFlare, and some others
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $_SERVER['HTTPS']='on';
<pre>
== .htaccess example with http-> https redirect redirect ==
<pre>
# BEGIN WordPress
AddHandler application/x-httpd-php70s .php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
<If "-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https'">
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</If>
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END WordPress
</pre>
</pre>

Latest revision as of 18:21, 28 November 2018


blank pages is the theme's way of telling you "something broke dude"

quick troubleshooting - `wp theme list` then `wp theme activate twentyseventeen`

wp-cli is your friend use it.

composer is your friend , use it.

sample composer.json:

{
  "name": "company/project",
  "description": "Company Website",
  "type": "project",
  "repositories": [
     {
       "type": "composer",
       "url": "https://wpackagist.org"
     }
  ],
  "require": {
     "johnpbloch/wordpress": "4.7.2",
     "philippbaschke/acf-pro-installer": "^1.0",
     "humanmade/S3-Uploads": "1.1.0",
     "psy/psysh" : "~0.6",
     "symfony/process" : "3.2",
     "wpackagist-plugin/ajax-load-more": "2.13.1",
     "wpackagist-plugin/custom-post-type-ui": "1.5.1",
     "wpackagist-plugin/megamenu": "2.3.4",
     "wpackagist-plugin/timber-library": "1.2.1",
     "wpackagist-plugin/wordfence": "6.3.0",
     "wpackagist-plugin/wordpress-seo": "4.1"
   },
   "extra": {
        "wordpress-install-dir": "public_html/wp",
        "installer-paths": {
            "public_html/wp/wp-content/plugins/{$name}": [
                "type:wordpress-plugin"
            ]
        }
    }
}

sample file layout:

├── composer.json
├── composer.lock
├── public_html
│   ├── report
│   ├── wp
│   │   ├── composer.json
│   │   ├── db
│   │   ├── index.php
│   │   ├── license.txt
│   │   ├── readme.html
│   │   ├── wp-activate.php
│   │   ├── wp-admin
│   │   ├── wp-blog-header.php
│   │   ├── wp-comments-post.php
│   │   ├── wp-config.php
│   │   ├── wp-config-sample.php
│   │   ├── wp-content
│   │   ├── wp-cron.php
│   │   ├── wp-includes
│   │   ├── wp-links-opml.php
│   │   ├── wp-load.php
│   │   ├── wp-login.php
│   │   ├── wp-mail.php
│   │   ├── wp-settings.php
│   │   ├── wp-signup.php
│   │   ├── wp-trackback.php
│   │   └── xmlrpc.php
└── vendor
    ├── autoload.php
    ├── bin
    │   ├── php-parse -> ../nikic/php-parser/bin/php-parse
    │   ├── psysh -> ../psy/psysh/bin/psysh
    │   └── wp -> /var/www/site.ca-v0.0.1/vendor/wp-cli/wp-cli
    ├── composer
    │   ├── autoload_classmap.php
    │   ├── autoload_files.php
    │   ├── autoload_namespaces.php
    │   ├── autoload_psr4.php
    │   ├── autoload_real.php
    │   ├── ClassLoader.php
    │   ├── installed.json
    │   ├── installers
    │   └── LICENSE
    ├── dnoegel
    │   └── php-xdg-base-dir
    ├── jakub-onderka
    │   ├── php-console-color
    │   └── php-console-highlighter
    ├── johnpbloch
    │   ├── wordpress
    │   └── wordpress-core-installer
    ├── nikic
    │   └── php-parser
    ├── philippbaschke
    │   └── acf-pro-installer
    ├── psr
    │   └── log
    ├── psy
    │   └── psysh
    ├── symfony
    │   ├── console
    │   ├── debug
    │   ├── polyfill-mbstring
    │   ├── process
    │   └── var-dumper
    ├── vlucas
    │   └── phpdotenv
    └── wp-cli
        └── wp-cli

apache config:

Listen 8080

<VirtualHost *:8080>

   ## Vhost docroot
   # DocumentRoot "/var/www/site.ca/public_html"
   DocumentRoot "/var/www/www.site.ca/public_html"

   ## Directories, there should at least be a declaration for /var/www/site.ca/public_html

   <Directory "/var/www/www-dev.sys.site.ca">
      Options -Indexes +MultiViews +FollowSymLinks
      AllowOverride All
      Require all granted
   </Directory>

SetEnvIf x-forwarded-proto https HTTPS=on
    ## Logging
   ErrorLog "/var/log/apache2/site.ca_8080_error.log"
   ServerSignature Off
   CustomLog "/var/log/apache2/site.ca_8080_access.log" combined

</VirtualHost>

plain web behind https LB, in wp-config.php

// Amazon AWS Elastic Load Balancer, CloudFlare, and some others
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $_SERVER['HTTPS']='on';

<pre>

== .htaccess example with http-> https redirect redirect ==

<pre>
# BEGIN WordPress
AddHandler application/x-httpd-php70s .php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

<If "-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https'">
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</If>
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# END WordPress