Difference between revisions of "Apache Webserver"

From wiki.linuxonlinehelp.eu
Jump to navigation Jump to search
Line 1: Line 1:
 
__FORCETOC__
 
__FORCETOC__
== Redirects for Browser with .htaccess ==
+
=== Redirects for Browser with .htaccess ===
  
=== Redirect Browser by Language to other Websites ===
+
==== Redirect Browser by Language to other Websites ====
 
Create a .htaccess at the Webspace and enter:
 
Create a .htaccess at the Webspace and enter:
 
<pre>
 
<pre>
Line 15: Line 15:
 
different Sites.
 
different Sites.
  
=== Block Access to Subfolders wp-includes of Wordpress ===
+
==== Block Access to Subfolders wp-includes of Wordpress ====
 
<pre>
 
<pre>
 
<IfModule mod_rewrite.c>
 
<IfModule mod_rewrite.c>
Line 28: Line 28:
 
</pre>
 
</pre>
  
== Analyses and Diagnostics ==
+
=== Analyses and Diagnostics ===
  
=== Apache Log analyse on Console ===
+
==== Apache Log analyse on Console ====
 
create a bash script called apache-analyse.sh
 
create a bash script called apache-analyse.sh
 
enter:
 
enter:

Revision as of 16:14, 22 May 2017

Redirects for Browser with .htaccess

Redirect Browser by Language to other Websites

Create a .htaccess at the Webspace and enter:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^$ /linux-support-deutsch [L,R=301]
RewriteRule ^$ /linux-support-english [L,R=301]
</IfModule>

This will redir German and International Users to two different Sites.

Block Access to Subfolders wp-includes of Wordpress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>

Analyses and Diagnostics

Apache Log analyse on Console

create a bash script called apache-analyse.sh enter:

#!/bin/bash
cat /var/log/apache2/access.log | awk '{ print $1 }' | sort | uniq -c
exit 0

System Echos like this:

1573  www.domain2.de
3568  www.domain3.de
..