This discussion is archived
1 2 Previous Next 19 Replies Latest reply: Mar 7, 2011 2:41 AM by fac586 RSS

Nice URLs for HTML DB?

423056 Oracle ACE
Currently Being Moderated
Very relevant to this forum... I'd love to know everyones thoughts and if anyone has any input on how to get Nice URLs for HTMLDB... Kind Regards

http://www.bayontechnologies.com/bt/blog/archives/2005/04/nice_urls_for_h.php

---- CLIP FROM BLOG ----
I think HTMLDB is quite a gem in the Oracle Database offering. It is a great data centric GUI building tool; if you need a quick GUI for an Oracle based application consider HTMLDB. I got on to HTMLDB when I used it to build an administrative tool for an OWB Data Warehouse for a large publisher in Boston. I did so because it was free and easy, but quickly became addicted!

Asktom runs on HTMLDB; obviously it scales! So, assuming you don't mind vendor lock in (will only run on Oracle) for your database, HTMLDB can be used as a GUI for custom applications, intranet applications, and extranet applications. Rapid, productive, and FREE with the database! Excellent! It's powerful enough to even build publicly accessible websites, like AskTom...

That's where I'm getting into a pickle! Publicly accessible sites have some additional requirements. Scalability, check. Professional looking templates, check. URLs acceptable for bookmarking and search engine ranking, big screeching crashing halt!

For those unfamiliar with search engine indexing in general, here's the summary:
Search Engines generally rank lower pages with identical content, if their content is determined by parameters to the right of the "?" In other words (and entirely without proof) the following AskTom page on "Fast Wild Card Searching" (http://asktom.oracle.com)

/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:37336026927381
would be ranked higher for some google searches if it's URL was more like this:
/pls/ask/4950/8/fast_wc_srchs.html?p=::sess:NO

There's an entire industry built around how to ensure that your valuable content is mated with people searching for it. It would be tough to sell a company on using a solution that will almost certainly decrease their ability to reach customers (google users) with the content they put into their application.

I've used mod_rewrite before on simple point solutions to help make a site google friendly. However there is some significant work to be done(maps of page IDs to page names, maps of application IDs to names, complicated regex, etc) to create a mod_rewrite solution to make HTML DB urls easier on the eyes, bookmarks, and better indexed by search engines.

Anyone facing similar issues? Anyone have any prior art they wouldn't mind sharing with the community? Please email me (boy, I really need to get my comments working on my blog) and I'll be happy to post any information on it here.
---- END CLIP FROM BLOG ----
  • 1. Re: Nice URLs for HTML DB?
    434393 Newbie
    Currently Being Moderated
    Dear Nicholas Goodman,
    i totally aggree to you that having nicer urls for htmldb would bring another boost for htmldb. I did some testings with mod_rewrite but they all do basically work not very well. Especially the Session id is annoying if you like to have only Reporting Pages which are public.
    Maybe somebody from htmldb Dev. could provide an answer
    how to translate the htmldb URL:
    f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
    into something google-readable.
    sincerely, Alex
  • 2. Re: Nice URLs for HTML DB?
    23119 Newbie
    Currently Being Moderated
    Nicholas,

    I agree with you. The mod_rewrite can't be considered as good and reliable approach here because it certainly doubles work required to support growing public site and it's out of HTMLDB. I would prefer to have ability to associate URLs inside of HTMLDB.
  • 3. Re: Nice URLs for HTML DB?
    VANJ Journeyer
    Currently Being Moderated
    I have been using mod_rewrite quite effectively and havent had any problems with it. Here are some of my rewrite rules
    ^/$ /pls/htmldb [R] ==> This maps http://server to the development login page

    ^/app1$ /pls/htmldb/f?p=123:1 [R] ==> This sets up a "shorcut" for app1. This can be extended to any number of apps/pages
    Regarding

    f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly

    You can leave the "session" parameter blank since it varies from session to session. If you use a authentication scheme that utilizes the remember_deep_link feature, HTML DB will automatically generate a new session id and preserve the rest of the URL.

    In my experience, most pages just need the f?p=app:page, nothing else.

    Hope this helps
  • 4. Re: Nice URLs for HTML DB?
    434393 Newbie
    Currently Being Moderated
    Dear Vikas Agnihotri,

    well, i tried already what you are proposing. But unfortunatly that is not the challange.

    Imaging you have an application that provides localized Information like Restaurants or Hotels or whatever. Using a folder Structure will result in something like this and it's optimal for google because google does prefer plain html pages:

    http://server/germany/nordsee/hamburg/restaurant1

    Actually in HTMLDB the URL would most probably look like this.

    f?p=ba:ergebnis:::::P1_ADR_COUNTRY,P1_ADR_REGION,P1_ADR_CITY,P1_NAME:germany,nordsee,hamburg,restaurant1

    eg: that make a rewrite rule like this

    RewriteRule ^/([^.]+).*/([^.]+).*/([^.]+).*/([^.]+).*$ /pls/ef/f?p=ba:ergebnis:::::P1_ADR_COUNTRY,P1_ADR_REGION,P1_ADR_CITY,P1_NAME:$1,$2,$3,$4 [R]

    BUT: the User gets back the HTMLDB-like URL and [PT] is not working for some reason. It would be great if the world would not recognize that htmldb is working in the background..

  • 5. Re: Nice URLs for HTML DB?
    434393 Newbie
    Currently Being Moderated
    Sorry rewrite should be something like this (i forgot to identify the Parameter by a prefix). Most probably this could be done better with a tricky RegExp but it's doing its job..
    ..
    RewriteRule ^/c_([^.]+).*/r_([^.]+).*/cy_([^.]+).*/n_([^.]+).*$ /pls/ef/f?p=ba:ergebnis:::::P1_ADR_COUNTRY,P1_ADR_REGION,P1_ADR_CITY,P1_NAME:$1,$2,$3,$4 [R]
    ..
    Makes a URL like:
    http://server/c_germany/r_nordsee/cy_hamburg/n_restaurant1
    ..

  • 6. Re: Nice URLs for HTML DB?
    VANJ Journeyer
    Currently Being Moderated
    You are certainly on the right track. If you use the [R] flag, mod_rewrite does a redirect using HTTP code 302 and the user will see the rewritten URL in the location bar, thats by design. To preserve whatever the user types in, you are right, the PT flag seems appropriate. Why it is not working is a question for the mod_rewrite folks.

    But why would you want to do all this? Why "hide" the fact that HTML DB is working behind the scenes? Its nothing to be ashamed of! Providing nice URLs for users to type/bookmark is fine, mod_rewrite can do that just fine, you already seem to have gotten it to work with your example. But after that, why care what URL shows up in the location bar?

    As far as indexing by Google is concerned, ask the folks at Google if there are any other means to get Google's spider to crawl such pages since the URL contain a dyamic session id. Maybe you can put the URL you want indexed in some META tags in the page content itself for Google's spider.

    Thanks
  • 7. Re: Nice URLs for HTML DB?
    434393 Newbie
    Currently Being Moderated
    Well, i think i got something now...
    As long as i only like to send public Pages having parameters, HTMLDB seems not to care about the Session ID (which defenitly makes sense somehow). This means having a Rewrite Rule like :
    ..
    RewriteRule ^/country_([^.]+).*$ /pls/ef/f?p=ba:ergebnis:111111111111111111::::P1_COUNTRY:$1 [PT]
    ..
    will work even with Path Through because HTMLDB seems to accept this dummy Session ID (hope that won't change in the future).
    ..
    It's not that i would not like to tell the world how sensational HTMLDB is but Customers and Google simply do not care about the Technology beneath.
    ..
  • 8. Re: Nice URLs for HTML DB?
    466586 Newbie
    Currently Being Moderated
    This **really** should go on the TO-DO list for the roadmap of Apex ,

    The idea is not to hide the fact which system is being used, but rather to present a more structured URL for visitors and search engines (robots specifically)

    A simple application preference would boost the usability of this (to be able to still use htmldb generated code to jump between pages, for instance)

    So default url syntax would be :
    f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly

    and admin could modify it to his/hers preference. f.i.
    /$app_alias./&page_alias.\.html?attr=$session_id.:Debug:ClearCache............


    This would allow designer to create a more SEO / bookmark friendly urls and loose none of the functionality of APEX. (since the htmldb engine would produce the requested url syntax)

    Of course the admin would have to already set up mod_rewrite to use PT to the original syntax of "f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly"

    so the only change would be the URL generated in displayed pages.
  • 9. Re: Nice URLs for HTML DB?
    VANJ Journeyer
    Currently Being Moderated
    You could do all this today, this has nothing to do with HTML DB.

    Just setup the proper Apache mod_rewrite rules to display whatever URLs you want to see in your browser.
  • 10. Re: Nice URLs for HTML DB?
    466586 Newbie
    Currently Being Moderated
    Of course this has to do with Apex.

    I know I can create any type of url with mod_rewrite today. the problem is getting the application to create them. mod_rewrite usage is pretty much useless if your web application does not reference the nice urls. (besides, you get penalized for duplicate content as soon as SE's find out that /nice/url linked from / is the same as /pls/htmldb/f?p=........ linked from within the app)

    example, create new app, create page 1 and 2. Create a report on page 1 (select 2 from dual) , make column one link to page 2 (using the selection option "page in this app" rather then handmade URL)
    and the link htmldb produces will look like f?p=.......

    I can get this by producing every link by hand:
    select '[a href=/nice/url/........[/a]' from dual;
    thats no problem.

    The feature Im looking for is to see the htmldb engine produce these urls automatically after user preference. So in the above example I could simply use select 2 from dual; and link column1 to page 2, and the url htmldb produces will be /nice/url/.. rather then f?p=
  • 11. Re: Nice URLs for HTML DB?
    marife Newbie
    Currently Being Moderated
    SELECT 2 FROM DUAL will always give you the number 2. Why not just write a database function that builds the URL? You pass in the page number and it returns the URL like:

    SELECT HTMLDB_URL(2) FROM DUAL

    The problem is that you will have to keep an eye on the format for the call to the "f" function because Oracle could change it in the future.

    Mike
  • 12. Re: Nice URLs for HTML DB?
    466586 Newbie
    Currently Being Moderated
    SELECT 2 FROM DUAL will always give you the number 2
    Well, yes,. which I wanted it to do (to simplify the example).
    Why not just write a database function that builds the URL? You pass in the page number and it returns the URL like:
    As I stated above, I want to use built-in branching methods instead of hardcoding direct urls and referencing them always with an external function.
    The problem is that you will have to keep an eye on the format for the call to the "f" function because Oracle could change it in the future
    Another reason this should be built in. Users of Apex will be using their own url reconstruction so why not build support for it?

    ---
    To clarify, this is definetly a "nice to have", nothing more.. I know that this can be done today. But having it built in would make life so much easier.

    (just f.y.i. I have built a web application, running live, handling 100.000 pageviews a day using only mod_plsql (I have 3 flat files, a css and 2 small images, rest is in the db). It surpasses in speed any other language that has tried to duplicate the functionality. One of the first things I did was to create a url-resolve for each package to print out the correct url depending on my mod_rewrite configurations (which are split into 4 files due to size). All the pages look like http://host/maintopic/subtopic/id.html . Its a nice feature that has its perks when publishing in a live environment. My main reason for not migrating to Apex is its url handling.(its superior in everything else) )
  • 13. Re: Nice URLs for HTML DB?
    VANJ Journeyer
    Currently Being Moderated
    "Nice" (traditional) search-engine friendly URLs like /wow/look/how/deep/I/am are fine for hierarchical static content but Apex is all about dynamic content. That involves "intelligent" URLs that have parameters, values, etc. How do search engines index such dynamic content? They probably don't.

    Yes, I agree that HTML DB could generate CGI-style URLs like
    script?par1=value1&par2=val2&...
    instead of stuffing everything into its own "proprietary" colon-delimited string. Would that make it any easier on the spiders to index it? (I don't know)

    Hopefully someone from Oracle will jump in and share their thoughts...

    Thanks
  • 14. Re: Nice URLs for HTML DB?
    Oli_t Newbie
    Currently Being Moderated
    I have received e-mail requests to explain the mod_rewrite functionality (due to this post),
    So here is one of my answers :

    This is quite easy to do with Apache (or Oracle HTTP Server) and I would love to see Oracle change their URL handling in Apex (or at least allow for programmatic changes to the URI layout).

    First of all I have a directive in my plsql.conf to turn url rewrites on :

    ---
    RewriteEngine on
    Options +FollowSymLinks
    ---

    Then I do some basic rewriting for the host :
    --
    rewriteCond %{HTTP_HOST} ^myweb.com
    rewriteRule ^(.+) http://www.myweb.com$1 [L,R=301]
    --
    (This simply redirects any requests from http://myweb.com/some/path.html to http://www.myweb.com/some/path.html, Google and Teoma have a hard time with coping with duplicate content within the same webserver)

    Then I do a system wide rewrite for Blob images that I show on the web. :
    --
    RewriteRule ^/icons/(.*)\.jpg$ /dad1/get_icon?v_numer=$1 [PT,L]
    RewriteRule ^/pictures/(.*)\.jpg$ /dad1/get_image?v_numer=$1 [PT,L]
    --

    I have to do this since the browser does not believe that something that looks like a CGI script can be an image that is constant and will not retrieve it fast nor cache it.
    So this dramatically speeds up the loading time on the browsers end.

    Last in the plsql.conf I point to a file where I put all my page rewrites into:

    --
    Include "/u01/webroot/myweb.com/conf/page_rewrite.conf"
    --

    In that file I have a rewrite for each page that is published and I want to have a "flat file" look to the URI.
    Examples:

    --
    RewriteRule ^/topic/widget/([^/]+)/printer/([^/]+)\.html$ /dad1/widget.printerfriendly?color=$2&maxdepth=$1 [PT,L]
    RewriteRule ^/topic/widget/([^/]+)/([^/]+)\.html$ /dad1/widget.showlong?color=$2&maxdepth=$1 [PT,L]
    RewriteRule ^/topic/widget/(.*)\.html$ /dad1/widget.print?color=$1 [PT,L]

    RewriteRule ^/topic/index.html /dad1/page.home [PT,L]
    RewriteRule ^/topic/gallery.html /dad1/birta?sidu=18 [PT,L]
    RewriteRule ^/topic/search$ /dad1/search.html [PT,L]
    RewriteRule ^/topic/disclaimer.html$ /dad1/pack1.proc2 [PT,L]
    --


    Now that we have all the rewrites setup within the Apache we need to make sure that our coding reflects the url layouts. You do not really benefit from these rewrites if you still in the code create links in the old format.
    So within our coding we need to make sure that we are referencing the new layout. so for instance:

    instead of creating an A HREF for /dad1/widget.print?color=blue we change it to look like /topic/widget/blue.html .. Note that both URI's will work since we haven't really disabled the old URI style, just created a new one to work also.

    Regards
    Oli
1 2 Previous Next