Home

mod_rewrite - Clientx

 

+

Search Tips   |   Advanced Search

 

  1. Overview
  2. Procedure for Meta Prod

 

Overview

 

Procedure

To enable Rewrite Engine...

  1. cd /data01/opt/ihs/ihs60/conf

  2. In httpd.conf, uncomment...

    LoadModule rewrite_module modules/mod_rewrite.so

  3. In clientx.conf, add rewrite code.

    Here is an example for prodtest.clxb2c.com


    ServerAlias prodtest.clxb2c.com
    #################################################
    #Modification Clientx STARTS
    # Rewrite all requests that come in from domains other than prodtest.clxb2c.com or
    # the IP addresses to go to the home page or a page specified in the vhost.map file
    # If only a pagename in the URI send to ExternalPageInvoker

    RewriteEngine on
    RewriteLog "/data01/opt/ihs/ihs60/logs/rewrite_port80_log"
    RewriteLogLevel 0

    # This maps non www.clientx.com domains to specific landing pages
    RewriteMap lowercase int:tolower
    RewriteMap vhost txt:/data01/opt/ihs/ihs60/conf/vhost.map


    RewriteCond %{REQUEST_URI} !^/.*/.*
    RewriteCond %{REQUEST_URI} !^/.*\.(txt|gif|jpg|jpeg|htm|html|ico|gz|css|js)$
    RewriteCond ${lowercase:%{REQUEST_URI}|} ^/(.+)$
    RewriteRule ^/(.+)$ http://prodtest.clxb2c.com/webapp/wcs/stores/servlet/ExternalPageInvoker?landingPage=%1&hostName=%{HTTP_HOST}&%{QUERY_STRING} [R,L]

    # Check for non prodtest.clxb2c.com domain names and route according to the vhost.map
    RewriteCond %{HTTP_HOST} !^$
    RewriteCond ${lowercase:%{HTTP_HOST}|} ^(.+)$
    RewriteCond %{HTTP_HOST} !^prodtest.clxb2c.com$
    RewriteCond %{HTTP_HOST} !^192.168.
    RewriteCond %{HTTP_HOST} !^10.1.
    RewriteCond ${vhost:%1|} ^(.*)$
    RewriteRule ^/(.*)$ http://prodtest.clxb2c.com/webapp/wcs/stores/servlet/ExternalPageInvoker?landingPage=%1&hostName=%{HTTP_HOST} [R,L]


    # Grab any remaining BV URLs and send them to the home page
    RewriteCond %{REQUEST_URI} ^/(clx|Website)/.*$
    RewriteRule ^/(.*)$ http://prodtest.clxb2c.com/webapp/wcs/stores/servlet/ExternalPageInvoker?landingPage=homepage [R,L]

    # Send any requests for / to home page
    RedirectMatch permanent ^/$ http://prodtest.clxb2c.com/webapp/wcs/stores/servlet/home|10001|10051|-1

    #Modification Clientx ENDS
    #################################################

  4. Create empty vhost.map file...

    touch vhost.map
    cxxod 777 vhost.map
    chown ihsadm vhost.map

  5. Cycle IHS

    cd /data01/opt/ihs/ihs60/conf
    ./apachectl restart

  6. Verify app is up...

    http://Test1MetaStage.clxb2c.com/webapp/wcs/stores/servlet/home|10001|10051|-1