[Typo3-dev] Porposal for a lean real URL solution

Peter Russ peter.russ at 4dfx.de
Tue Aug 31 23:57:58 CEST 2004


In Germany there is a saying, that when a paper clip would be invented 
today there would be at least 6 hinge involved, oil change has to be 
done every 6 month and there has to be at least one maintenance per year.

 From a programmer's standpoint I believe that RealUrl might be an 
excellent solution. From the  developer's point of view I prefer less 
for more. Less code for more reliability. Less bugs for more productivity.

That the reason why I want to come up with a different approach. These 
are the

Posits
-------
1.There is almost everything available either in Typo3 or in Apache.
2.Changes are minimal.
3.Existing extensions can be used as usual without any changes.
4.This solution should even work for static if no MySql or PHP or Typo3 
is available.
5. Performance should be much better than today.

Status
------
To get a real URL approach we would need something in the form:
<http:://[servername]/[path/to/document/]>document.html
or
<http:://[servername]/[path/to/document/]>index.html
and similar.
At the moment and without any additional extension Typo3  can only 
deliver pages in the form
                               <id>.html
or
                             <alias>.html
or
                  <pagetitle>.<id/alias>.<type>.html
or
                            index.php?id=<id>
or
                            index.php?id=<alias>
and last both examples extended with type information.

The <id> or <alias> information has to be unique and is required to get 
the requested page. The drawback of this solution is when altering the 
page the URL for the page changes. Today
                            Service.29.0.html
might be tomorrow
                            Service.122.0.html
as the Service section might be redesigned totally. This is neither an 
advantage for external search engines or personal bookmarks, as they get 
obsolete within minutes. It is a loss on information and reliability.

On the other side Typo3 offers the alias. Utilizing this the request for 
the page might look like
                           Service.service.html
or
                               service.html
and similar.

<id> and <alias> has to be unique. At the moment the <alias> is limited 
to a maximum of 20 characters and has to consist of characters a-z or 
numbers or '_' and '-' (alphanum_x).

Approach
--------
1.Extend the <alias> in that way, that it contains the information for 
an real URL.
2.Get Apache configured in that way to deliver filter the requests.

Proposal
1.Extension of the allowed signs:
        t3lib_tcemain::checkValue_input_Eval to handle also the '/' as 
allowed sign:
				case 'alphanum_dir':
				    $value = ereg_replace('[^a-zA-Z0-9_-/]','',$value);
				break;
2.Extension of <alias>:
typo3/sysext/cms/ext_tables.php:
		'alias' => Array (
			'label' => 'LLL:EXT:cms/locallang_tca.php:pages.alias',
			'config' => Array (
				'type' => 'input',
				'size' => '10',
				'max' => '255',  // TBD might be more???
//				'eval' => 'nospace,alphanum_x,lower,unique'
				'eval' => 'nospace,alphanum_dir,lower,unique'
			)
		),
3.Extension of the page table:
        alias varchar(255) DEFAULT '' NOT NULL,
4.Extension of ts_lib/publish.php:
        line 122 new : $temp_fileName = 
str_replace('/','.',$TSFE->getSimulFileName());
5.Adjust .htaccess

For the first step it would be sufficient to generate the <alias> 
manually. On the second there might be a solution to do this 
automatically (e.g. moving a page would automatically adjust the alias). 
Also language information could be included or added the publish_dir 
information.

Benifits
--------
1.All extensions could use the alias information by default:
        company/focus
        company/focus/reliable_products
2.Static files would be in the form:
        company.focus.html
        company.focus.reliable_products.html
3.Apache would translate the request for
        company/focus/reliable_products.html to
        company.focus.reliable_products.html
cached in publish_dir.
4.If the file does not exists it would redirect to
        index.php?id=company/focus/reliable_products
5.No overhead.

This solution should work within one day.

Do I miss something? Any drawbacks?
 From my standpoint this solution should be lean and reliable and WORK.

Regs. Peter Russ.




More information about the TYPO3-dev mailing list