Oracle Application Express is using its own syntax to pass URL parameters, called the f?p syntax. In fact, there is only one standard URL search-path parameter: "p". This makes APEX URL’s less readable for users and very difficult to understand for search engines. In my session I will explain and demonstrate a few techniques to use standard URL syntax in conjunction with APEX, in order to present pretty URL’s to users and search engines, just using the APEX Listener and the database.
2. Questions
• What are URLs
(to humans and Search Engines)
• How are APEX URLs different?
• How can we optimize this?
(using Oracle DB, ORDS, APEX only)
• Why am I sitting in this conference room and
not having a beer at the bar?
3.
4.
5. What is a URL?
• A URL is human-readable text that was designed
to replace the numbers (IP addresses) that
computers use to communicate with servers.
They also identify the (file) structure on the given
website.
• URLs describe a site or page to visitors and search
engines. Keeping them relevant, compelling, and
accurate is the key to ranking well.
6. Comparison of URLs
for a Canon Powershot SD400 Camera
1. Amazon.com :
http://www.amazon.com/gp/product/B0007TJ5OG/
102-8372974-
4064145?v=glance&n=502394&m=ATVPDKIKX0DER
&n=3031001&s=photo&v=glance
2. DPReview.com :
http://www.dpreview.com/reviews/canonsd400/
7. Benefits of URLs
• Semantics
URL should semantically make sense. This is
helpful to both humans and search engines.
• Relevancy
Semantically correct URL are more likely to get
search engine-referred traffic due to the
keywords in the URL. These, like title tags, are
used for determining relevancy and computing
rankings.
8. APEX URLs - f?p Syntax
• apex.somewhere.com is the URL of the server
• pls is the indicator to use the mod_plsql cartridge
• apex is the database access descriptor (DAD) name.
The DAD describes how HTTP Server connects to the
database server so that it can fulfill an HTTP request.
The default value is apex.
• f?p= is a prefix used by Oracle Application Express
• 4350 is the application being called
• 1 is the page within the application to be displayed
• 220883407765693447 is the session number
urlsyntax.oracleapex.com
http://apex.somewhere.com/pls/apex/f?p=4350:1:220883407765693447
9. URLs and Search Engines
“Help Google crawl your site more
efficiently by indicating how we
should handle parameters in your
URLs.”
“ Use this feature only if you're
sure how parameters work.
Incorrectly excluding URLs could
result in many pages disappearing
from search.”
10. URL Parameters & Google
To Google, the APEX app
seems to be one page?!
11. Transforming f?p Syntax
Typical URL containing a query string:
http://server/path/program?field1=value1&field2=value2&field3=value3...
f?p=App:Page:Sess:Req:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
Possible to transform f?p syntax?
Yes, using flexible parameters passing:
http://server/path/!schema.ff?app=100&page=1&session=1234567
&item1=value1&item2=value2&item3=value3...
12. flexible f
create or replace procedure apex_demo.ff(name_array in owa.vc_arr
, value_array in owa.vc_arr)
is
type f_param_array is table of varchar2(32767)
index by varchar2(20);
v_f_p_arr f_param_array;
v_f_p varchar2(32767);
v_inames varchar2(32767);
v_ivalues varchar2(32767);
begin
v_f_p_arr('app') := '';
v_f_p_arr('page') := '';
v_f_p_arr('session') := '';
v_f_p_arr('request') := '';
v_f_p_arr('debug') := '';
v_f_p_arr('clearcache') := '';
v_f_p_arr('printerfriendly') := '';
…
13. flexible f cont.
…
for i in 1 .. name_array.count
loop
if lower(name_array(i)) in ('app', 'page', 'session',
'request', 'debug', 'clearcache', 'printerfriendly')
then
v_f_p_arr(lower(name_array(i))) := value_array(i);
else
if length(v_inames) > 0
then
v_inames := v_inames || ',';
v_ivalues := v_ivalues || ',';
end if;
v_inames := v_inames || name_array(i);
v_ivalues := v_ivalues || value_array(i);
end if;
end loop;
…
18. RESTful pretty URL
http://www.themes4apex.nl/apex/rokit/t4a/examples/eng/fifapex
APEX base url
workspace
name URI Resource Template
URI Prefix
(optional)
http://www.themes4apex.nl/apex/f?p=104:3:0::::T4A_LANG,P3_PROJECT:ENG,fifapex
recommended: Peter Raganitsch, session “Going Public”
http://www.oracle-and-apex.com/hrurl-human-readable-urls-in-oracle-apex/
19. How do SEs find URLs
Crawling
“Google's crawl process begins with a list of web
page URLs, generated from previous crawl
processes, and augmented with Sitemap data
provided by webmasters. As Googlebot visits each
of these websites it detects links on each page and
adds them to its list of pages to crawl. New sites,
changes to existing sites, and dead links are noted
and used to update the Google index.”
22. robots.txt
• A robots.txt file restricts access to your site by search
engine robots that crawl the web. These bots are
automated, and before they access pages of a site,
they check to see if a robots.txt file exists that prevents
them from accessing certain pages.
• You need a robots.txt file only if your site includes
content that you don't want search engines to index. If
you want search engines to index everything in your
site, you don't need a robots.txt file (not even an
empty one).
• in the root of the web site hierarchy!
28. re-routing backend
create or replace PROCEDURE redirect
IS
t_host VARCHAR2(250);
t_redir proxy_rules%ROWTYPE;
BEGIN
t_host := OWA_UTIL.get_cgi_env('host');
SELECT *
INTO t_redir
FROM (SELECT *
FROM proxy_rules
WHERE UPPER(t_host) LIKE UPPER(host_pattern) /* matching rules */
ORDER BY seq, id)
WHERE ROWNUM < 2;
IF t_redir.url_type = 'X'
THEN
f(p => t_redir.apex_app || ':' || t_redir.apex_page || ':' || t_redir.apex_session);
ELSE
OWA_UTIL.redirect_url(curl => t_redir.redir_url, bclose_header => TRUE);
END IF;
EXCEPTION
WHEN OTHERS
THEN
OWA_UTIL.redirect_url(curl => 'http://www.rokit.nl', bclose_header => TRUE);
END redirect;
29. defaults.xml for re-routing
<entry key="misc.defaultPage">apex</entry>
<entry key="misc.defaultPage">redirect</entry>
(public synonym & grant execute to PUBLIC)