Thursday, September 20, 2012

Oracle HTTP Server Mod_rewrite to Redirect to Apex Home Page

Suppose you have Oracle Fusion Middleware 11.1.1.2.0 Web Tier installed and it is required to redirect the base URL:
   http://<hostname>:<port>
to the default APEX application URL (APP_ID =1001)
   http://<hostname>:<port>/apex/f?p=1001

The Solution

  1. You will need to add the RewriteRule directives to the httpd.conf file inside the virtual host that was configured to listen on mentioned <port>.
    RewriteEngine on
    RewriteLog logs/rewrite.log
    RewriteRule ^/$ /apex/f?p=1001 [R]
    RewriteRule ^/index.html$  /apex/f?p=1001 [R]
    
  2. Restart HTTP Server so changes will take effect.
  3. Test accessing http://<hostname>:<port>, it should redirect you to the APEX application page.
This will start Apex application with predefined default page.

Redirect to non default page

If you want to start specific application page (non default) change:
 
RewriteRule ^/$ /apex/f?p=1001 [R]
RewriteRule ^/index.html$  /apex/f?p=1001 [R]
to
 
RewriteRule ^/$ /apex/f?p=1001:xxx [R]
RewriteRule ^/index.html$  /apex/f?p=1001:xxx [R]
where xxx is Apex page number you want to start.

The End

This is nothing but making one official reminder for future reference ...
Hope this helps someone.
Cheers!

3 comments:

  1. HI Damir,
    I have this problem:

    my apex app have this URL:
    http://apex.mydomain.local:7778/pls/apex/f?p=115

    i would like to have

    apex.mydomain.com but i cannot hide the apex app id, es. 115.
    es. apex.mydomain.com/f?p=115

    Can you help me??

    Tanks.
    Alan G.

    ReplyDelete
    Replies
    1. Here is explained how to manage initial url.
      If you want permanent hiding you have to write rule with regular expression in that case.
      Rg
      Damir

      Delete
  2. This comment has been removed by the author.

    ReplyDelete