apache_conf Apache截断授权标头

添加此条目以避免Apache截断Authorization标头

.htaccess
<IfModule mod_setenvif.c>
  SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>

apache_conf Drupal 8 .htaccess文件(以防我需要副本)

来自[什么是Drupal 8网站的理想.htaccess文件](https://drupalabc.xyz/question/what-ideal-htaccess-file-drupal-8-website)

.htaccess
#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|install|make|module|profile|po|sh|.*sql|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
  </IfModule>
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Add correct encoding for SVGZ.
AddType image/svg+xml svg svgz
AddEncoding gzip svgz

# Most of the following PHP settings cannot be changed at runtime. See
# sites/default/default.settings.php and
# Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be
# changed at runtime.

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value assert.active                   0
  php_flag session.auto_start               off
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_flag mbstring.encoding_translation    off
  # PHP 5.6 has deprecated $HTTP_RAW_POST_DATA and produces warnings if this is
  # not set.
  php_value always_populate_raw_post_data   -1
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On
  ExpiresByType image/jpg "access plus 60 days"
  ExpiresByType image/jpeg "access plus 60 days"
  ExpiresByType image/gif "access plus 60 days"
  ExpiresByType image/png "access plus 60 days"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/html "access plus 1 month"
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType text/x-javascript "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresDefault "access plus 1 month"

  <FilesMatch \.php$>
    # Do not allow PHP scripts to be cached unless they explicitly send cache
    # headers themselves. Otherwise all scripts would have to overwrite the
    # headers set by mod_expires if they want another caching behavior. This may
    # fail if an error occurs early in the bootstrap process, and it may cause
    # problems if a non-Drupal PHP file is installed in a subdirectory.
    ExpiresActive Off
  </FilesMatch>
</IfModule>

# Set a fallback resource if mod_rewrite is not enabled. This allows Drupal to
# work without clean URLs. This requires Apache version >= 2.2.16. If Drupal is
# not accessed by the top level URL (i.e.: http://example.com/drupal/ instead of
# http://example.com/), the path to index.php will need to be adjusted.
<IfModule !mod_rewrite.c>
  FallbackResource /index.php
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Set "protossl" to "s" if we were accessed via https://.  This is used later
  # if you enable "www." stripping or enforcement, in order to ensure that
  # you don't bounce between http and https.
  RewriteRule ^ - [E=protossl]
  RewriteCond %{HTTPS} on
  RewriteRule ^ - [E=protossl:s]

  # Make sure Authorization HTTP header is available to PHP
  # even when running as CGI or FastCGI.
  RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # Block access to "hidden" directories whose names begin with a period. This
  # includes directories used by version control systems such as Subversion or
  # Git to store control files. Files whose names begin with a period, as well
  # as the control files used by CVS, are protected by the FilesMatch directive
  # above.
  #
  # NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
  # not possible to block access to entire directories from .htaccess because
  # <DirectoryMatch> is not allowed here.
  #
  # If you do not have mod_rewrite installed, you should remove these
  # directories from your webroot or otherwise protect them from being
  # downloaded.
  RewriteRule "/\.|^\.(?!well-known/)" - [F]

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/foo will be redirected to http://www.example.com/foo)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} .
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/foo will be redirected to http://example.com/foo)
  # uncomment the following:
   RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
   RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupalabc.xyz
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Redirect common PHP files to their new locations.
  RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(rebuild.php)
  RewriteCond %{REQUEST_URI} !core
  RewriteRule ^ %1/core/%2 [L,QSA,R=301]

  # Rewrite install.php during installation to see if mod_rewrite is working
  RewriteRule ^core/install.php core/install.php?rewrite=ok [QSA,L]

  # Pass all requests not referring directly to files in the filesystem to
  # index.php.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

  # For security reasons, deny access to other PHP files on public sites.
  # Note: The following URI conditions are not anchored at the start (^),
  # because Drupal may be located in a subdirectory. To further improve
  # security, you can replace '!/' with '!^/'.
  # Allow access to PHP files in /core (like authorize.php or install.php):
  RewriteCond %{REQUEST_URI} !/core/[^/]*\.php$
  # Allow access to test-specific PHP files:
  RewriteCond %{REQUEST_URI} !/core/modules/system/tests/https?.php
  # Allow access to Statistics module's custom front controller.
  # Copy and adapt this rule to directly execute PHP files in contributed or
  # custom modules or to run another PHP application in the same directory.
  RewriteCond %{REQUEST_URI} !/core/modules/statistics/statistics.php$
  # Deny access to any other PHP files that do not match the rules above.
  # Specifically, disallow autoload.php from being served directly.
  RewriteRule "^(.+/.*|autoload)\.php($|/)" - [F]

  # Rules to correctly serve gzip compressed CSS and JS files.
  # Requires both mod_rewrite and mod_headers to be enabled.
  <IfModule mod_headers.c>
    # Serve gzip compressed CSS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

    # Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

    # Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
    RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

    <FilesMatch "(\.js\.gz|\.css\.gz)$">
      # Serve correct encoding type.
      Header set Content-Encoding gzip
      # Force proxies to cache gzipped & non-gzipped css/js files separately.
      Header append Vary Accept-Encoding
    </FilesMatch>
  </IfModule>
</IfModule>

# Various header fixes.
<IfModule mod_headers.c>
  # Disable content sniffing, since it's an attack vector.
  Header always set X-Content-Type-Options nosniff
  # Disable Proxy header, since it's an attack vector.
  RequestHeader unset Proxy
  
  <FilesMatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
        Header set Cache-Control "max-age=2678400, public"
  </FilesMatch>
  <FilesMatch "\.(html|htm)$">
        Header set Cache-Control "max-age=7200, private, must-revalidate"
  </FilesMatch>
  <FilesMatch "\.(pdf)$">
        Header set Cache-Control "max-age=86400, public"
  </FilesMatch>
  <FilesMatch "\.(js)$">
        Header set Cache-Control "max-age=2678400, private"
  </FilesMatch>

</IfModule>

# Enable Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
</IfModule>
<IfModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

SetEnvIfNoCase User-Agent "^libwww-perl*" block_bad_bots
Deny from env=block_bad_bots

apache_conf Переадресациячерезhtaccessнаоснованииязыкавбраузере

htaccess
<IfModule mod_rewrite.c>
# редирект на русскоязычную версию сайта для русских и украинской браузеров
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{HTTP:Accept-Language} (ru|uk) [NC]
RewriteRule .* http://www.hotel-aleksander.eu/ru/ [R=302,L]
RewriteCond %{HTTP:Accept-Language} (sl) [NC]
RewriteRule .* http://www.hotel-aleksander.eu/sl/ [R=302,L]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteRule .* http://www.hotel-aleksander.eu/en/ [R=302,L]
</IfModule>

apache_conf SEO开发清单

这些是执行SEO Dev Checklist需要运行的步骤。 <br/> <br/> - 缓存htaccess <br/> - 设置SSL并重定向到https:// www <br/> - 调整Google Analytics以包含https:// www <br/> - Search Console <br/> - 网站地图创建<br/> - 搜索控制台中的索引网站<br/> - Google跟踪代码管理器<br/> - 调整元标记/网址变量/规范+无内容隐藏<br/> - 添加现代化工具<br/> - 组合和最小化CSS <br/> - 组合和最小化JS <br/> - 将图像转换为Webp(CSS和图像)<br/> <br/>您可以在此测试您的进度:https://开发人员.google.com / speed / pagespeed / insight / <br/> <br/>这里是原始的SEO检查表供参考:https://docs.google.com/spreadsheets/d/1er2moYivqD_eDF3chigB0RNlH0lwJ5Z_HrSsyAMqtiA/edit#gid=0

notes
# SEO Dev Checklist steps

## htaccess

Place the attached .htaccess in the root directory of the site. It sets cache durations for the site. 

Note: the filename should be ".htaccess" \
Note #2: If the site already has an .htaccess file add the code in the attached .htaccess file to the top of the existing file

## SSL & One Version of Site

We need to set up an SSL certificate for the site and then put two redirects in place so that only one version of the site is ever served.

**NOTE: if the site is using Cloudflare then use the Cloudflare steps instead (find them at the bottom of this section)**

1. Contact GT to get them to create the SSL - ask them for Let's Encrypt SSL (note that you are launching a new site for a longterm client, the domain may be using CGI instead of PHP-FRM. Advise GT about this in the email)
2. Test the site to make sure there are no concole errors, and fix any that you find ** DOUBLE CHECK any photo galleries **
3. Set up the following redirects once there are no errors
    * log in to the admin server through winscp (use SFTP with no private key). the login will be:
	
    	blendweb1.nmsrv.com or blendweb2.nmsrv.com \
    	id: admin \
    	pass: ba89dboys!@#$% \
    	directory: /etc/httpd/vhost

    * domain.com.conf (note: only needed if the site isn't already a subdomain, eg: investors.powerbandsolutions.com): 
    ```
		RewriteCond %{HTTPS} !on
		RewriteCond %{HTTP:X-Forwarded-Protocol} !HTTPS
		RewriteCond %{THE_REQUEST} !xml.php
		RewriteRule /(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    ```

    * domain.com.ssl.conf:
    ```
		RewriteEngine on
		RewriteCond %{HTTP_HOST} !^www\. [NC]
		RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=permanent]
    ```
    * *Note: when you save your changes WinSCP will return an error, disregard it and close the error box.
    * *Second Note: DO NOT EDIT domain.com.ssl.conf IF you are setting up a subdomain as www.subdomain.com will not exist

4. Restart the apache server through putty
	- login with the same credentials to the server in putty
	- once logged in type: service apache graceful
	
5. Once the HTTPS is in place log into our Google Analytics account for the site and go to: Admin -> Property Settings -> Default URL (login in with webstats@blendermedia.com: https://analytics.google.com/analytics/)

### Cloudflare Steps

If the site is using cloudflare then it will already have a certificate installed and our process is different. Here are the steps:

1. Go to the Crypto tab for the domain in cloudflare
2. Set both "Always Use HTTPS" and "Automatic HTTPS Rewrites" to on
3. Go to the Page Rules tab
4. Click "Create Page Rule"
5. First box enter "example.com/*" where example is your domain
6. Click "add a setting", select "Forwarding URL", select "301 Permanent Redirect", into the field place "https://www.example.com/$1"
7. Done **Note: it may take a few minutes for you to see your change**
	
## Update Google Analytics to include https://www.

* Login into https://analytics.google.com/analytics/web/
* Login with webstats@blendermedia.com. 
* Go to admin -> view -> view settings -> Adjust Website's URL to include https://www.

## Search Console

* Login into https://search.google.com/search-console/welcome and create a property for the site. (select the right hand option "URL Prefix")
* Login with webstats@blendermedia.com. 


## Sitemap

* You can create a sitemap here: https://www.xml-sitemaps.com/. 
* Upload the sitemap.xml file to the root of the live site, add it within the Google search console by clicking "sitemaps" in the menu and then going through the add process.

## Index URL in Search Console

* After uploading the sitemap click URL inspection in the left menu and submit the url of the site
* Once it find the URL you can click "RERQUEST INDEXING" in the result box which is returned from your search

## Google Tag Manager

* Set-up at https://tagmanager.google.com/. 
* Login with webstats@blendermedia.com and create an account for the company and site. 
* Then add the supplied code where recommended. **After you've added the code you need to publish the changes in Google Tag Manager** (if you don't you'll get a console error for the missing tag manager file hosted by google).

## Adjust Meta tags / url variables / canonical + no content hiding

### Meta Tags

Use these for your titles and descriptions in your meta tags

```
<!--|if $meta_title != ''|--><!--|$meta_title|--><!--|else|-->Company Name: <!--|$structure|--><!--|/if|-->

<!--|if $meta_description != ''|--><!--|$meta_description|--><!--|else|-->Default description<!--|/if|-->
```

### Canonical tag on the inner pages

Place this code in the head in of your page templates. 

```
<!--|if $structure_directory == "page-with-no-content"|-->
<meta name="robots" content="noindex">
<!--|else|-->
<link rel="canonical" href="<!--|$canonical|-->"/>
<!--|/if|-->
```

## Add Modernizer

We need to include modernizer to check for webp browser support. Place this code before the closing body tag (it's modernizer but it ONLY includes the webp support, if your site is already using modernizer continue using it but include webp support).

```
<script>
/*! modernizr 3.6.0 (Custom Build) | MIT *
 * https://modernizr.com/download/?-webp-setclasses !*/
!function(e,n,A){function o(e,n){return typeof e===n}function t(){var e,n,A,t,a,i,l;for(var f in r)if(r.hasOwnProperty(f)){if(e=[],n=r[f],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(A=0;A<n.options.aliases.length;A++)e.push(n.options.aliases[A].toLowerCase());for(t=o(n.fn,"function")?n.fn():n.fn,a=0;a<e.length;a++)i=e[a],l=i.split("."),1===l.length?Modernizr[l[0]]=t:(!Modernizr[l[0]]||Modernizr[l[0]]instanceof Boolean||(Modernizr[l[0]]=new Boolean(Modernizr[l[0]])),Modernizr[l[0]][l[1]]=t),s.push((t?"":"no-")+l.join("-"))}}function a(e){var n=u.className,A=Modernizr._config.classPrefix||"";if(c&&(n=n.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+A+"no-js(\\s|$)");n=n.replace(o,"$1"+A+"js$2")}Modernizr._config.enableClasses&&(n+=" "+A+e.join(" "+A),c?u.className.baseVal=n:u.className=n)}function i(e,n){if("object"==typeof e)for(var A in e)f(e,A)&&i(A,e[A]);else{e=e.toLowerCase();var o=e.split("."),t=Modernizr[o[0]];if(2==o.length&&(t=t[o[1]]),"undefined"!=typeof t)return Modernizr;n="function"==typeof n?n():n,1==o.length?Modernizr[o[0]]=n:(!Modernizr[o[0]]||Modernizr[o[0]]instanceof Boolean||(Modernizr[o[0]]=new Boolean(Modernizr[o[0]])),Modernizr[o[0]][o[1]]=n),a([(n&&0!=n?"":"no-")+o.join("-")]),Modernizr._trigger(e,n)}return Modernizr}var s=[],r=[],l={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var A=this;setTimeout(function(){n(A[e])},0)},addTest:function(e,n,A){r.push({name:e,fn:n,options:A})},addAsyncTest:function(e){r.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=l,Modernizr=new Modernizr;var f,u=n.documentElement,c="svg"===u.nodeName.toLowerCase();!function(){var e={}.hasOwnProperty;f=o(e,"undefined")||o(e.call,"undefined")?function(e,n){return n in e&&o(e.constructor.prototype[n],"undefined")}:function(n,A){return e.call(n,A)}}(),l._l={},l.on=function(e,n){this._l[e]||(this._l[e]=[]),this._l[e].push(n),Modernizr.hasOwnProperty(e)&&setTimeout(function(){Modernizr._trigger(e,Modernizr[e])},0)},l._trigger=function(e,n){if(this._l[e]){var A=this._l[e];setTimeout(function(){var e,o;for(e=0;e<A.length;e++)(o=A[e])(n)},0),delete this._l[e]}},Modernizr._q.push(function(){l.addTest=i}),Modernizr.addAsyncTest(function(){function e(e,n,A){function o(n){var o=n&&"load"===n.type?1==t.width:!1,a="webp"===e;i(e,a&&o?new Boolean(o):o),A&&A(n)}var t=new Image;t.onerror=o,t.onload=o,t.src=n}var n=[{uri:"data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=",name:"webp"},{uri:"data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==",name:"webp.alpha"},{uri:"data:image/webp;base64,UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA",name:"webp.animation"},{uri:"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=",name:"webp.lossless"}],A=n.shift();e(A.name,A.uri,function(A){if(A&&"load"===A.type)for(var o=0;o<n.length;o++)e(n[o].name,n[o].uri)})}),t(),a(s),delete l.addTest,delete l.addAsyncTest;for(var p=0;p<Modernizr._q.length;p++)Modernizr._q[p]();e.Modernizr=Modernizr}(window,document);
</script>	
```


## Combine and Minimize CSS

We are going to go through all of the vendor css files and combine them into one minified file. This minimizes the critical rendering path and reduces load time.

Note: some vendor files will include files relatively called (font awesome for example), these files can't be combined and minified in this manner. Also keep in mind we are not minmizing any **working css files** which we'll need to edit in the future.

Also it's important to place a comment outlining what files are included in your minified file so it can be undone if needed.

Use this site to create your minified code: https://www.minifier.org/

EG: 
 ```
<!-- INCLUDE CSS:
<link href="//fonts.googleapis.com/css?family=Muli:300,400,700,800" rel="stylesheet">
<link rel="stylesheet" href="//use.typekit.net/ebi1jvb.css">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.css" />
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
-->
<link rel="stylesheet" href="source/css/include.min.css">
 ```
 Place code immediately preceding the call to style.css

## Combine and Minimize JS (move to bottom)

Just as we did with the CSS we need to combine and minify all of the JS vendor files. We also want to move any JS that we can to the bottom of the document before the closing body tag.

EG: 
```
<!-- INCLUDE JS:
<script src="//cdnjs.cloudflare.com/ajax/libs/loadCSS/2.1.0/loadCSS.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js"></script>
<script src="source/js/twitterfeed.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
-->
<script type="text/javascript" src="source/js/include.min.js"></script>
```
Place code immediately preceding scripts.js

## Convert Images to Webp (CSS & Images)

The intention is to go through the site and replace all large images with optimized jpgs, or webp files if supported. Also to server smaller images for mobile. **In general we'd want to do this for any images larger than 200px wide and we can probably disregard the images in any sort of listing (eg: news, blog, events etc.)** Use your best judgement when deciding if you shoudl optimise an image.

With the inclusion of modernizer (above) our html element get's a clas of webp or no-webp. That class allows us to serve webp images through our css if supported.

If you have not yet configured your system to be able to create the webp image files go to this snippet and follow those steps: https://snippets.cacher.io/snippet/5e172f13d8240aca5a9d

**Add webp to CSS**

- go through the CSS and search for large background image files we can replace
- once found download the image files you'd like to convert to your WEBP\img\ folder and run your cmd line batch on them
- upload your new files to the same location on the server
- Here is the code needed for each image file:
	```
	/* WEBP CSS */
	html.no-webp header {background-image:url(../img/.jpg);}
	html.webp header {background-image:url(../img/.webp);}
	/*--*/
	@media screen and (max-width: 900px) {
	html.no-webp header {background-image:url(../img/-900px.jpg);}
	html.webp header {background-image:url(../img/-900px.webp);}
	}
	@media screen and (max-width: 600px) {
	html.no-webp header {background-image:url(../img/-600px.jpg);}
	html.webp header {background-image:url(../img/-600px.webp);}
	}
	```
- NOTE: if any of the images you're replacing were already under 900px or 600px wide then you'll have less files and less media queries to add.
- You need to replace "header" with the css elements you're targeting (ie for: #projects .banner {background-image:url();} you'd use #projects .banner)
- you copy the path before the file extension and replace "../img/". Note: if your original image is png you'll need to change the .jpg in this code to .png
- finally you comment out the original background-image declaration from the code (having the original call still there but commented out is useful for any other devs that may need to work on the template in the future).
- You need those 6 css lines for EVERY image you're replacing. My method is to copy and paste that code out once for each image, make the adjustments to include each image and THEN reorganize my css so that I only have two media queries total. Below is an example which includes 2 images:
	```
	/* WEBP CSS */
	html.no-webp header {background-image:url(../img/image1.jpg);}
	html.webp header {background-image:url(../img/image1.webp);}
	html.no-webp header {background-image:url(../img/image2.jpg);}
	html.webp header {background-image:url(../img/image2.webp);}
	/*--*/
	@media screen and (max-width: 900px) {
	html.no-webp header {background-image:url(../img/image1-900px.jpg);}
	html.webp header {background-image:url(../img/image1-900px.webp);}
	html.no-webp header {background-image:url(../img/image2-900px.jpg);}
	html.webp header {background-image:url(../img/image2-900px.webp);}
	}
	@media screen and (max-width: 600px) {
	html.no-webp header {background-image:url(../img/image1-600px.jpg);}
	html.webp header {background-image:url(../img/image1-600px.webp);}
	html.no-webp header {background-image:url(../img/image2-600px.jpg);}
	html.webp header {background-image:url(../img/image2-600px.webp);}
	}
	```
	- SPECIAL NOTE: If the site you're working on has any JS functions that set background images you'll need to adjust them to server the correct images. The code will be dependant on what the function is doing, but here is an example which should help:
	```
	if($('html').hasClass('webp')){
		if($('body').innerWidth() > 900){
	    	$url = $url.replace('.jpg','.webp');
	 	} else if($('body').innerWidth() > 600){
    		$url = $url.replace('.jpg','-900px.webp');
    	} else {
    		$url = $url.replace('.jpg','-600px.webp');
    	}
    }
    ```

**Add webp to image tags:**

We also need to replace the ```<img>``` on the site (where applicable) with new code which will display the correctly sized image in the correct format .

- Again, like we did for the CSS, we need to find and convert all of our images. 
- Do a quick run-through of the site and determine 1) what pages your images are on and 2) where they are located on the server
- Once found download the image files you'd like to convert to your WEBP\img\ folder and run your cmd line batch on them
- upload your new files to the same location on the server
- Here is the code for you need to replace your ```<img>``` tags with (generally you'll only need the first section of code but I've included multiple use cases to copy and paste from):

    **Full Size:**
    ```
		<picture>
			<source media="(max-width: 600px)" srcset="-600px.webp" type="image/webp" />
			<source media="(max-width: 900px)" srcset="-900px.webp" type="image/webp" />
			<source media="(min-width: 901px)" srcset=".webp" type="image/webp">			
			<source media="(max-width: 600px)" srcset="-600px.jpg" type="image/jpeg" /> 
			<source media="(max-width: 900px)" srcset="-900px.jpg" type="image/jpeg" />
			<source media="(min-width: 901px)" srcset=".jpg" type="image/jpeg">			
			<img src=".jpg" alt="" />
		</picture>
    ```
    **Less than 900px:**
    ```
		<picture>
			<source media="(max-width: 600px)" srcset="-600px.webp" type="image/webp" />
			<source srcset=".webp" type="image/webp">
			<source media="(max-width: 600px)" srcset="-600px.jpg" type="image/jpeg" /> 
			<source srcset=".jpg" type="image/jpeg">
			<img src=".jpg" alt="" />
		</picture>
    ```
    **Less than 600px JPG:**
    ```
		<picture>
			<source srcset=".webp" type="image/webp">
			<source srcset=".jpg" type="image/jpeg">
			<img src=".jpg" alt="" />
		</picture>
    ```
    **Less than 600px PNG:**
    ```
		<picture>
			<source srcset=".webp" type="image/webp">
			<source srcset=".png" type="image/png">
			<img src=".png" alt="" />
		</picture>
    ```

## TESTING

You can test that all your changes are working here: https://developers.google.com/speed/pagespeed/insights/
.htaccess
## 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 image/webp "access 1 year"
ExpiresByType text/css "access 1 year"
ExpiresByType text/html "access 1 year"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 year"
</IfModule>
## EXPIRES CACHING ##

apache_conf Laravel .htaccess具有安全性和优化功能

Laravel .htaccess具有安全性和优化功能

.htaccess
# Directory Listing
Options -Indexes

<IfModule mod_security.c>
    # Server Information Disclosure
    ServerTokens Prod
    ServerSignature Off
    SecServerSignature " "
</IfModule>

<IfModule mod_headers.c>
    # X-Frame-Options header missing
    Header append X-FRAME-OPTIONS "SAMEORIGIN"

    # XSS Protection Not Enabled
    Header set X-XSS-Protection "1; mode=block"

    # Missing X-Content-Type-Options is not specified
    Header set X-Content-Type-Options nosniff
</IfModule>

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Force HTTPS
    # Use this if you are not behind any proxies
    # RewriteCond %{HTTP:X-Forwarded-Proto} !https
    # RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]

    ## Block bad bots
    RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
    RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
    RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
    RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
    RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
    RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
    RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]
    RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
    RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
    RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
    RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
    RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
    RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
    RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
    RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]
    RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]
    RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
    RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]
    RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
    RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]
    RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
    RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
    RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
    RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]
    RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]
    RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]
    RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
    RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
    RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
    RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
    RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
    RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
    RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
    RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
    RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]
    RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
    RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
    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
    RewriteRule ^.* - [F,L]

    # TRACE method enabled
    # Forbid access to all URIs for http TRACE, OPTIONS, PUT, DELETE and PATCH requests
    # Disable only TRACE, due to behaviour of Laravel need to handle normal CRUD Operation
    # OPTIONS is enabled as well due to when mobile application consume API, it will call
    # OPTIONS method first, before calling the GET / POST / PUT method.
    RewriteCond %{REQUEST_METHOD} ^(TRACE)
    RewriteRule .* - [F]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

<IfModule mod_expires.c>
  ExpiresActive On

  # Images
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresByType image/vnd.microsoft.icon "access plus 1 year"

  # Video
  ExpiresByType video/mp4 "access plus 1 year"
  ExpiresByType video/mpeg "access plus 1 year"

  # CSS, JavaScript
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"

  # Others
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
  ExpiresByType application/json "access plus 1 month"
</IfModule>

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/json
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

apache_conf ÜbernahmeEinträgeausContao 3

snippets_c3.htaccess
##
# Disable ETags 
# aus Contao 3 entnommen
# @see http://developer.yahoo.com/performance/rules.html#etags
##
FileETag None
<IfModule mod_headers.c>
  Header unset ETag
</IfModule>

##
# Set the proper MIME types
# aus Contao 3 entnommen
# @see https://github.com/h5bp/html5-boilerplate
##
<IfModule mod_mime.c>
  AddType application/javascript              js jsonp
  AddType application/json                    json
  AddType audio/ogg                           oga ogg
  AddType audio/mp4                           m4a f4a f4b
  AddType video/ogg                           ogv
  AddType video/mp4                           mp4 m4v f4v f4p
  AddType video/webm                          webm
  AddType video/x-flv                         flv
  AddType image/svg+xml                       svg svgz
  AddEncoding gzip                            svgz
  AddType application/vnd.ms-fontobject       eot
  AddType application/x-font-ttf              ttf ttc
  AddType font/opentype                       otf
  AddType application/x-font-woff             woff woff2
  AddType image/x-icon                        ico
  AddType image/webp                          webp
  AddType text/cache-manifest                 appcache manifest
  AddType text/x-component                    htc
  AddType application/xml                     rss atom xml rdf
  AddType application/x-web-app-manifest+json webapp
  AddType text/x-vcard                        vcf
  AddType application/x-shockwave-flash       swf
</IfModule>

##
# Gzip compression
# aus Contao 3 entnommen
# @see https://github.com/h5bp/html5-boilerplate
##
<IfModule mod_deflate.c>
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
    AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
    AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
  </IfModule>
</IfModule>

##
# Expires headers (for better cache control)
# aus Contao 3 entnommen
# @see https://github.com/h5bp/html5-boilerplate
##
<IfModule mod_expires.c>
  ExpiresActive on

  ##
  # Productional website
  ##
  ExpiresByType text/cache-manifest           "access plus 0 seconds"
  ExpiresByType text/html                     "access plus 0 seconds"
  ExpiresByType text/xml                      "access plus 0 seconds"
  ExpiresByType application/xml               "access plus 0 seconds"
  ExpiresByType application/json              "access plus 0 seconds"
  ExpiresByType application/rss+xml           "access plus 1 hour"
  ExpiresByType application/atom+xml          "access plus 1 hour"
  ExpiresByType image/gif                     "access plus 1 month"
  ExpiresByType image/png                     "access plus 1 month"
  ExpiresByType image/jpeg                    "access plus 1 month"
  ExpiresByType image/x-icon                  "access plus 1 month"
  ExpiresByType video/ogg                     "access plus 1 month"
  ExpiresByType audio/ogg                     "access plus 1 month"
  ExpiresByType video/mp4                     "access plus 1 month"
  ExpiresByType video/webm                    "access plus 1 month"
  ExpiresByType text/x-component              "access plus 1 month"
  ExpiresByType application/x-font-ttf        "access plus 1 month"
  ExpiresByType font/opentype                 "access plus 1 month"
  ExpiresByType application/x-font-woff       "access plus 1 month"
  ExpiresByType image/svg+xml                 "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  ExpiresByType text/css                      "access plus 1 year"
  ExpiresByType application/javascript        "access plus 1 year"

  ##
  # Disable caching during development
  # @see https://github.com/contao/core/issues/4364
  ##
  #ExpiresByType text/cache-manifest           "access"
  #ExpiresByType text/html                     "access"
  #ExpiresByType text/xml                      "access"
  #ExpiresByType application/xml               "access"
  #ExpiresByType application/json              "access"
  #ExpiresByType application/rss+xml           "access"
  #ExpiresByType application/atom+xml          "access"
  #ExpiresByType image/gif                     "access"
  #ExpiresByType image/png                     "access"
  #ExpiresByType image/jpeg                    "access"
  #ExpiresByType image/x-icon                  "access"
  #ExpiresByType video/ogg                     "access"
  #ExpiresByType audio/ogg                     "access"
  #ExpiresByType video/mp4                     "access"
  #ExpiresByType video/webm                    "access"
  #ExpiresByType text/x-component              "access"
  #ExpiresByType application/x-font-ttf        "access"
  #ExpiresByType font/opentype                 "access"
  #ExpiresByType application/x-font-woff       "access"
  #ExpiresByType image/svg+xml                 "access"
  #ExpiresByType application/vnd.ms-fontobject "access"
  #ExpiresByType text/css                      "access"
  #ExpiresByType application/javascript        "access"
  
</IfModule>

##
# Header adjustments
# aus Contao 3 entnommen
##
<IfModule mod_headers.c>

  ##
  # Disable caching during development
  # @see https://github.com/contao/core/issues/4364
  ##
  #Header unset Cache-Control
  #Header append Cache-Control must-revalidate

  ##
  # Do not cache the cron.txt file
  # @see https://github.com/contao/core/issues/5105
  ##
  <FilesMatch "cron\.txt$">
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
  </FilesMatch>

  ##
  # Add a Vary Accept-Encoding header for the compressed resources. If you
  # modify the file types above, make sure to change them here accordingly.
  # @see http://developer.yahoo.com/performance/rules.html#gzip
  #
  # Note: If you are using a case-sensitive file system like HFS+ or ext4, you
  # have to change the <FilesMatch> directive as follows:
  #
  # <FilesMatch "\.(?i:js|css|xml|gz|svgz)$">
  #
  # For more information see: https://github.com/contao/core/issues/4364
  ##
  <FilesMatch "\.(js|css|xml|gz|svgz)$">
    Header append Vary Accept-Encoding
  </FilesMatch>

  ##
  # Do not cache source map files
  # @see https://github.com/contao/core/issues/8532
  ##
  <FilesMatch "\.map$">
    Header set Expires "0"
    Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
  </FilesMatch>

</IfModule>

 # Für den Fehler 404 ist die app.php des CMS verantwortlich, die sich intern 
 # um die Fehlerbehandlung kuemmert
 
 ErrorDocument 404 /app.php

apache_conf Umleitung auf www und https

umleitung_www_https.htaccess
# non-www to www
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# force https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]

apache_conf .htaccess重定向https

.htaccess
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

#oppure

RewriteCond %{ENV:HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

apache_conf 常时SSL化

htaccess
<IfModule mod_rewrite.c>

	RewriteEngine On

	RewriteCond %{HTTP_HOST} ^willstyle\.sakura\.ne\.jp$
	RewriteRule ^(.*)$ https://www.willstyle.co.jp/$1 [R=301,L]

	RewriteCond %{HTTP_HOST} ^willstyle.co.jp$
	RewriteCond %{REQUEST_URI} !^/app/wp-cron.php$
	RewriteRule ^(.*)$ https://www.willstyle.co.jp/$1 [R=301,L]

	RewriteCond %{HTTP_HOST} ^www.willstyle.co.jp$
	RewriteCond %{ENV:HTTPS} !^on$
 	RewriteCond %{HTTP:X-Sakura-Forwarded-For} ^$
	RewriteCond %{REQUEST_URI} !^/app/wp-cron.php$
	RewriteRule ^(.*)$ https://www.willstyle.co.jp/$1 [R=301,L]

</IfModule>

apache_conf htaccessリダイレクト

htaccess
# フォルダ以下を転送
RewriteRule ^フォルダ名\.* https://research.zozo.com/ [R=301,L]