Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > static URLs

Reply
Thread Tools

static URLs

 
 
Jonathan N. Little
Guest
Posts: n/a
 
      04-02-2006
Okay I have been futzing with this for a bit, so a request other viewpoints.

Using a website database and you want to present with static URLs so a
call to:

http://www.example.com/frontend.php?id=2

Becomes:

http://www.example.com/page/2

With .htaccess:
RewriteRule ^page/([\d]*) frontend?id=$1 [L]

Ok, that takes care of static link in a webpage, but what if you want to
get a page as a result of some form query and still want the result to
appear as a static URL? Say a page selector form a could go to a
intermediate parsing script like:

<form action="http://www.example.com/q2url.php">
<select name="id">
<option value="25">Some page</option>
....

Where q2url.php is:

$id = $_GET['pageID'];
$redirect = "http://www.example.com/page/$id";
header("Location: $redirect");

So the result will appear again as a static:
http://www.example.com/page/25

Or is there another way to do this with a rewrite rule. If so any
advantages/disadvantages?



--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
 
Benjamin Niemann
Guest
Posts: n/a
 
      04-02-2006
Jonathan N. Little wrote:

> Okay I have been futzing with this for a bit, so a request other
> viewpoints.
>
> Using a website database and you want to present with static URLs so a
> call to:
>
> http://www.example.com/frontend.php?id=2
>
> Becomes:
>
> http://www.example.com/page/2
>
> With .htaccess:
> RewriteRule ^page/([\d]*) frontend?id=$1 [L]
>
> Ok, that takes care of static link in a webpage, but what if you want to
> get a page as a result of some form query and still want the result to
> appear as a static URL? Say a page selector form a could go to a
> intermediate parsing script like:
>
> <form action="http://www.example.com/q2url.php">
> <select name="id">
> <option value="25">Some page</option>
> ...
>
> Where q2url.php is:
>
> $id = $_GET['pageID'];
> $redirect = "http://www.example.com/page/$id";
> header("Location: $redirect");
>
> So the result will appear again as a static:
> http://www.example.com/page/25
>
> Or is there another way to do this with a rewrite rule. If so any
> advantages/disadvantages?


I can't think of a better way. The initial URL is created by the user-agent,
and this will always create ?id=NNN URLs. You may intercept the form
submission using JavaScript, construct the correct URL and use
window.location. But your q2url.php should still be in place to handle
non-JS user-agents.

BTW: make sure, your 'page selector' is not the only way to open a page, or
search engines will not find it.


--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      04-02-2006
Benjamin Niemann wrote:
> Jonathan N. Little wrote:
>
>> Okay I have been futzing with this for a bit, so a request other
>> viewpoints.
>>
>> Using a website database and you want to present with static URLs so a
>> call to:
>>
>> http://www.example.com/frontend.php?id=2
>>
>> Becomes:
>>
>> http://www.example.com/page/2
>>
>> With .htaccess:
>> RewriteRule ^page/([\d]*) frontend?id=$1 [L]
>>
>> Ok, that takes care of static link in a webpage, but what if you want to
>> get a page as a result of some form query and still want the result to
>> appear as a static URL? Say a page selector form a could go to a
>> intermediate parsing script like:
>>
>> <form action="http://www.example.com/q2url.php">
>> <select name="id">
>> <option value="25">Some page</option>
>> ...
>>
>> Where q2url.php is:
>>
>> $id = $_GET['pageID'];
>> $redirect = "http://www.example.com/page/$id";
>> header("Location: $redirect");
>>
>> So the result will appear again as a static:
>> http://www.example.com/page/25
>>
>> Or is there another way to do this with a rewrite rule. If so any
>> advantages/disadvantages?

>
> I can't think of a better way. The initial URL is created by the user-agent,
> and this will always create ?id=NNN URLs. You may intercept the form
> submission using JavaScript, construct the correct URL and use
> window.location. But your q2url.php should still be in place to handle
> non-JS user-agents.
>
> BTW: make sure, your 'page selector' is not the only way to open a page, or
> search engines will not find it.


Yes very true, no this 'page selector ' is in *addition* to the standard
navigation. Just wanted both methods to product the same static URL result.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JDBC URLs ...not really URLs? Adam Monsen Java 11 02-08-2009 08:14 PM
Converting Relative URLs into Absolute URLs Nathan Sokalski ASP .Net 1 08-12-2008 07:03 AM
Migrating static site to ASP.NET - How to handle redirecting old URLs? ITistic ASP .Net 2 06-12-2007 09:50 PM
dynamic URLS convert to static URLS for search engines Steve T. ASP .Net Web Services 7 03-04-2004 03:16 PM
Distinguish text URLs from non-text URLs? Kaidi Java 5 01-04-2004 10:15 AM



Advertisments