Apache
Avoid redirection of specific file
Not operator (!) can be used to avoid redirection of a particular file.
RewriteEngine on
RewriteCond %{REQUEST_URI} !/filename.php
RewriteCond %{REQUEST_URI} ^/(.*).php
RewriteRule ^(.*).php /redirect_file.php?variable_1=$1 [R]
To avoid rredirection of index file
RewriteEngine on
RewriteCond %{REQUEST_URI} !/index.php
RewriteCond %{REQUEST_URI} ^/(.*).php
RewriteRule ^(.*).php /test.php?variable_1=$1 [R]
..
How to ensure that apache is installe with DSO support
How to ensure that apache is installe with DSO support?
To confirm that your apache is compiled with the Dynamic Shared Object run the below command.
# httpd -l
OUTPUT:
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
If mod_so.c appears in the list of modules, then your Apache server can ..
Redirect optional rules
Here the second parameter in the url is optional
RewriteCond %{REQUEST_URI} /faq/?(.*)
RewriteRule ^faq/?(.*) ./user/discussions/index.php?page=$1 [QSA,L]
simple htaccess redirection
RewriteCond %{REQUEST_URI} /login/send-friend-request/(.*)
RewriteRule ^login/send-friend-request/(.*) ./user/friends/send_friend_request.php?tofriend=$1 [L]
htaccess redirecting image urls to a php page
RewriteCond %{REQUEST_URI} /poem-small-thumb/(.*)\.jpg
RewriteRule ^poem-small-thumb/(.*)\.jpg ./frontpage/smallthumb.php?id=$1 [L]
..
Access denied for other user
On linux server while using xampp if you come across error 403 while accessing phpmyadmin follow the below steps to rectify from error.
Error:
Access forbidden!
New XAMPP security concept:
Access to the requested directory is only available from the local network.
This setting can be configured in the file "httpd-xampp.conf".
..
Error - Status change detected: running
xampp starting problem after installing Microsoft web-matrix
I had problem starting XAMPP after installing Microsoft web-matrix on my windows laptop. Follow the below steps to enable or startXAMPP service.
Disabling web-matrix web deployment service
1) Click on start and search for 'services'
2) Open services
3) Search for 'web deployment agent service'
4) Stop ..
Error - java.lang.OutOfMemoryError: PermGen space
If your server gives a bad gateway error and you can find the below lines in the tomcat error log "java.lang.OutOfMemoryError: PermGen space", try the below solution
Add the flags along with -Xms and -Xmx values
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
Example: if in cause your starttomcat is in /usr/sbin/ then edit it and add the ..
How to set MaxPermSize parameter
How to change permgen space in Apache tomcat?
When you run a memory intensive java web application or lot of domains or application in a single Tomcat, you might face Permgen out of space issue. At this scenario you can alter the permgen value and increase its size
Permgen can be altered ..
Apache optimization: KeepAlive On or Off
Apache
Apache is the most widely used web server on the Internet. Knowing how to get the most out of Apache is very important for a systems administrator. Optimizing Apache is always a balancing act. Its a case of sacrificing one resource in order to obtain savings in another.
What is KeepAlive?
HTTP ..
Auto start tomcat server
The below script will help you to start tomcat automatically. To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.
# vi /etc/init.d/tomcat
Now paste in the following:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export ..
Re-Compiling apache with open ssl n SOAP
The below is an simple example to recompile apache. Normally apache is installed with some basic modules, here we are re-compiling apache with opwn-ssl and SOAP module, which is normally not installed along with the apache.
Steps to install apache
# su
# wget http://www.eng.lsu.edu/mirrors/apache//httpd/httpd-2.2.17.tar.gz
# tar -zxvf httpd-2.2.17.tar.gz
Login as ..
How to find apache server performance
To find the performace of apache server there are several linux commands in common to find the web server performance. Normally we use lsof, netstat, top, vmstat, sar, apachetop and other tools are used to find the performance of apache.
mod_status is an wonderful apache module which is used to find ..
Apache Tips and handful Guide
This document is an quick reference. It gives you most of the answers on your question related to apache.
How do you check for the httpd.conf consistency and any errors in it?
# apachectl configtest
# apachectl graceful
What is the command to stop Apache?
kill the specific process that httpd ..
What are Xms and Xmx
what are Xms and Xmx values in apache tomcat?
A Java Virtual Machine on 32-bit operating systems typically has a maximum heap size of 64Mb. The JVM heap space is where all Java objects are stored, as well as memory used by the garbage collector.
The Java Virtual Machine takes two command ..
Redirect to mobile page
How to identify the mobile device using htaccess?
The mobile device can be identified by using HTTP_USER_AGENT, once the device is identified then it can redirected to a different page which is compatible to mobile device.
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^$ http://mobile.MYDOMAIN.com/ [L,R=302] ..
Apachectl start | stop | restart | graceful
The below command will restart the apache gracefully. It the apache is started already then it will report that the port is already occupied by the service.
# /usr/sbin/apachectl graceful
If Apache is not already running it will be started. If it is already running then it will reload with the ..