Dipesh Majumdar

Blog and Paintings

Adobe cq5, dispatcher, apache - Fundamental Questions and Answers - 2

April 19, 2014
  • Order of processing in apache ->

redirects are processed before aliases are processed.
Aliases and redirects are processed in the order they appear in the configuration files.
Example -
Alias /cat/dog /u01/app/oracle/product/10.2.0/db_1
Alias /cat /u01/app/oracle/product/11.1/db_1

if above order is changed - then all requests will end in first and second will never be executed. so specific type of rules should be written first.


  • from where website content is picked - > 2 places

1. DocumentRoot
one can find this by this command -> grep -i documentroot (for a website
2. from alias
Alias /cat/dog /u01/app/oracle/product/10.2.0/db_1

Trailing slash in alias is also meaningful. should be like this
Alias /cat/dog/ /u01/app/oracle/product/10.2.0/db_1/ or

Alias /cat/dog /u01/app/oracle/product/10.2.0/db_1


also if the above file location is not within document root - then it has to be allowed like this:
Alias /cat/dog /u01/app/oracle/product/10.2.0/db_1
<Directory /u01/app/oracle/product/10.2.0/db_1>
Order allow,deny
Allow from all

Alias /image /cat/dog/image
will cause a request with to get the jpg image picked from file system directory - /cat/dog/image/ and complete path with image would be /cat/dog/image/elephant.jpg
but if request is ->it can't do anything here -

but if the requirement is that location of image doesn't matter for the switching to filesystem location , then alias match should be used.

AliasMatch /image /cat/dog/image

Alias /image /cat/dog/image
AliasMatch /image /cat/dog/image
are not same

But what is same is -
Alias /image /cat/dog/image
AliasMatch ^/image(.*)$ /cat/dog/image/$1

  • Meaning of symbols in apache

^                                   : carrot symbol - means the start of string

$                                   : dollar symbol - means end of string

\.                                     :The  dot on is a special character in regular expressions, escape it with a backslash and it becomes a normal character

this is the way to do this:

RewriteRule ^([^.]*[^./])$ /$1.html

  • Basic Prerequisites of rewrite -

RewriteEngine on



now when you type this in browser : it invariably gives 404

because thee rewrite is not in place -

to make this work rewrite should look like this -

RewriteEngine on

RewriteCond %{REQUEST_URI} cat/

RewriteRule cat/

  • in the rewrite condition how to check for https -

Something like this can be tried....

RewriteCond %{HTTPS} on

RewriteCond %{HTTPS} !on  

RewriteCond %{SERVER_PORT} 81

RewriteCond %{SERVER_PORT} 443


  • How to check how a particular link behaves after it lands in the apache webserver - 

curl -I <url>

  • From where to find the dispatcher module and cq5 installables? 

Package share link:

  • where to set the proxy in cq5 author: 

in cq5 author system console, under configuration you can search for something like "HTTP Client 3.1" . Here you can set the proxy and also provide the white list, i.e, server names/ip addresses for those servers for which proxy will be bypassed.

  • How to check head response for a particular link from dispatcher?

curl -I -X HEAD

Fire the above curl command from one terminal of dispatcher and look at dispatcher log from another terminal. you can find the behaviour of the dispatcher for head response of the link.

  • How to find version of linux where dispatcher module is installed and then how to find cq5 dispatcher module version?

This command tells the version of linux: lsb_release -a

The dispatcher module can be downloaded from package share. when it is extracted the dispatcher module will look like this -

this means this dispatcher module is for apache version 2.x and dispatcher module version is 4.p.q 

(in above example x is number - like 1, 2 etc

p and q are also numbers like 1, 2 etc)

Inside httpd.conf there will be a line like this: 

LoadModule dispatcher_module path_of_dispatcher_module/

Adobe documentation suggests to simplify long-term maintenance  create a symbolic link named to the Dispatcher:
ln -s dispatcher-apache<x>-<os>-<rel-nr>.so

  • how to count the number of processes running   (read ps minus ef grep wc minus small L) - 

              ps -ef |wc -l

              suppose you want to count the number of java processes running, then this is the command - 

              ps -ef |grep java |wc -l


  • netstat -an |grep port_number   {the output TIME_WAIT & CLOSE_WAIT => remember TIME_WAIT means connection closed at local end and CLOSE_WAIT means connection closed at remote end}


  • from where to control the landing page - after logging in cq5? Answer: search for root under system console config mangager. here you can provide value like welcome.html or projects.html
  • About runmodes: very important point-> author run mode can't be changed to publish runmode after cq5 publisher applicaiton install so it's important to install correctly for the first time - so before starting publisher applicaton for the 1st time make sure you change author to publish in the start script: for run mode - check here: http://authorORpub:4502OR4503/system/console/status-slingsettings. One can unpack the cq5 software jar file and then edit the start script inside bin with something like this -  CQ_RUNMODE='publish,pqr, xyz,nosamplecontent' and then start the cq5 for the first time... then again stop it and edit repository.xml and crx-quickstart/conf folder according to requirement. After that cq5 application can be started once again but do note that from 2nd time start onwards - there will be no need to specify nosamplecontent. For further reading  on same topic you can refer this link:





Go Back