Warehouse for various notes, scripts, code samples, tips/tricks, etc. relating to different technologies like WebSphere Application Server (WAS), WebSphere Portal, Java, Java EE, DB2, etc.
Showing posts with label URL Redirection. Show all posts
Showing posts with label URL Redirection. Show all posts
Wednesday, October 19, 2011
Redirecting all users using Mobile devices to a specific URL
To redirect all the incoming requests from mobile devices to a sub-directory or a specific URL in IBM HTTP Server follow below steps:
Open C:\IBM\HTTPServer\conf\httpd.conf file in edit mode.
1. Un-comment following live in the file by removing "#" from the front of the line.
#LoadModule rewrite_module modules/mod_rewrite.so
2. Enable rewrite engine by adding following line to the end of the file:
RewriteEngine on
3. Add rewrite condition for the detecting mobile devices after the above line using the below example:
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
4. Add rewrite rule for redirecting the user to specific URL after the above line using the below example
RewriteRule ^(.*)$ http://mobile.example.com/wps/portal [L,R=302]
5. Save the file
6. Restart IBM HTTP Server.
Now all user requests will be redirected to "http://mobile.example.com/wps/portal" sub URL.
Enable user redirection in IBM HTTP Server 7.0
To redirect all the incoming requests to a sub-directory or a specific URL in IBM HTTP Server follow below steps:
Open C:\IBM\HTTPServer\conf\httpd.conf file in edit mode.
1. Un-comment following live in the file by removing "#" from the front of the line.
#LoadModule rewrite_module modules/mod_rewrite.so
2. Enable rewrite engine by adding following line to the end of the file:
RewriteEngine on
3. Add rewrite rule after the above line using the below example:
RewriteRule ^/$ wps/portal [L,R]
4. Save the file
5. Restart IBM HTTP Server.
Now all user requests will be redirected to "wps/portal" sub URL. You can redirect the user to another website also using the same method but in that situation you have to provide full URL starting with Http://...
Subscribe to:
Posts (Atom)