0
votes

I'm currently working on a ONEPAGE in TYPO3 and therefore collect all content of all subpages of page "Start" to output it together on page "Start".

Now I have the situation that in case someone knows the url to a subpage of the page "Start", then this page is outputted in the normal way without connection to the ONEPAGER which I do not want.

So, does someone have an idea on how to redirect all hits to a subpage of "Start" to the page "Start" itself.

I know that this can be achieved with htaccess/Apache rewrite but I'm looking for a general solution, e.g. with TYPO3 in-house means.

Thank you!

1
Did you find a solution?András Ottó

1 Answers

0
votes

This question depends on your needs. There are several ways to solve this.

1: You want a redirect:

A) realURL Redirects in the Info modul:

There is a way to write redirect rules for exact urls inside the TYPO3 backend. It could be handy if an editor should have some freedom to set those rules.

Advantage: An editor can have the opportunity to set the urls. You don't need any programming for that.

Disadvantage: You have no regex, you need to set each urls directly. IF you change a title, the redirect won't work anymore.

Go in the Info modul and select in the head line the "RealURL Management" and after by the Show the "Redirects" option.

B) Using encodeSpURL_postProc and decodeSpURL_preProc in RealURLConfiguration.php.

With this technic you can manipulate your "incoming" and "outgoing" urls. It is used if you want to shorten urls.

Here is an example, but for sure you can find more in google.

Advantage: You can make flexible regex rules.

Disadvantage: You need to write PHP code, and this logic will run by each outgoing links, so if you have a lot of links to transform it is may not the quickest option to pick.

C) You write two lines into your .htaccess.

So the point is, that if you have a clear rule to rewrites more urls and permanently. And if you have access to your .htaccess file then I strongly recommend you to use it. If you don't have more hundred or tausend specific redirects it is the best place to write your rule. It runs before any PHP code so it is definitely the quickest solution.

Advantage: You don't need to write as many code. It is the best way to redirect multiple urls and the performance is higher then any php code.

Disadvantage: Only if you have no access to the .htaccess file, because then you can not do it. Otherwise with to many redirects it is better to place the redirects into the httpd conf.

2: 404 for any wrong url.

You can handle the pages as they would be "wrong urls" like www.yourpage.com/it_is_a_not_existing_page/. It is recommended to have a 404 page to handle those problems.

In this case if you copy the parts from your website into the startpage you can set the pages to hidden, and then they will throw a 404 error just like a true invalid request.

I recommend you to think about the 404 solution and if not then use .htaccess.