How can I get URL's like
expample.com/home.html
in Typo3 950? Typo3 creates only URL's like
expample.com/home
without .html.
You can define the default page type by adding a route enhancer in your routing site configuration config.yaml.
routeEnhancers:
PageTypeSuffix:
type: PageType
default: '.html'
map:
'.html': 0
See also here https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.5/Feature-86160-PageTypeEnhancerForMappingTypeParameter.html
More about config.yaml file see https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/SiteHandling/Basics.html
Add this code to config.yaml:
routeEnhancers:
PageTypeSuffix:
type: PageType
default: '.html'
map:
'.html': 0
Then add a redirect in sitemanagement from index.html to example.com
Related
Problem
If you disable a site language of a configured TYPO3 site a redirect is automatically done to the "default" language.
I have configured two languages in my scenario (shortened site config example):
base: 'https://www.alrightsantleit.com/'
languages:
-
title: English
enabled: true
languageId: '0'
base: /en/
typo3Language: default
-
title: Deutsch
enabled: false
base: /de/
typo3Language: de
locale: de_DE.utf8
fallbackType: strict
fallbacks: ''
languageId: '1'
Redirect Check
curl -I https://www.alrightsantleit.com/de fails and leads into error 503
curl -I https://www.alrightsantleit.com/de/ succeeds and lead to status 301 with correct redirect to https://www.alrightsantleit.com/en/
How to fix this problem?
From a technical perspective and the strict routing (since TYPO3 v9 and up) an additional redirect without trailing slash must be added manually.
But is this the right solution for such scenario?
Do I have to force trailing slashes in each request (e.g. by using composer package studiomitte/redirect2trailingslash) by hand?
Is this some missing "feature" of TYPO3 to respect also a configured base without a trailing slash?
Can it be completely ignored and do have internet people learn to add proper trailing slashes when typing urls or when editors of external sites links without trailing slash in their website?
How do you solve that in your project? And what's the correct way to make it error-proof?
A 503 and a 303 is wrong, we would need a 404 in each case. A "hidden" language is exactly like a hidden page = 404 does not exist.
We add two things to all our installations with TYPO3 v9 or higher:
In the site configuration we add the trailing slash:
routeEnhancers:
PageTypeSuffix:
type: PageType
default: /
index: ''
map:
/: 0
And with the .htaccess we enforce the trailing slash for every request:
RewriteRule ^([^\.]*[^/])$ https://%{HTTP_HOST}/$1/ [L,R=301]
With that our URLs always have the trailing slash.
I want to rewrite the URL for search result from indexed_search but it's not working. Nothing happen.
I've added following RouteEnhancer to my config.yaml
routeEnhancers:
IndexedSearchPlugin:
type: Extbase
limitToPages:
- 38
extension: IndexedSearch
plugin: Pi2
routes:
- routePath: '/page/{page}'
_controller: 'Search::search'
_arguments:
page: '#widget_0/currentPage'
defaultController: 'Search::search'
defaults:
page: '0'
requirements:
page: \d+
aspects:
page:
type: StaticRangeMapper
start: '1'
end: '100'
Maybe somebody have an idea?
I don't use index_search a lot, but had a quick look at the code for the page browser. The page browser for indexed_search is done using a form and JavaScript, not direct links. So when clicking on a page in the page browser a hidden field is set and the form is submitted. Route enhancers will only work for links generated by TYPO3. I'm not sure why this is done this way, but without changing the way the page browser works you can't enhance these URLs.
I guess it depends on what you are trying to beautify. In my case I use this config.yaml to get a clean url for the search results (the search field is generated by TypoScript) and be able to search by a query.
Let's say we're having a page https:example.de/search/ with the indexed_search plugin placed on it.
Now searching from any page with the search field will result in this uri:
https:example.de/search/results
And you can deeplink to a special search result (here we're looking for 'lorem') by simply using that uri:
https:example.de/search/query/lorem
routeEnhancers:
IndexedSearchPlugin:
type: Extbase
namespace: tx_indexedsearch_pi2
routes:
- routePath: '/results'
_controller: 'Search::search'
_action: 'search::search'
- routePath: '/query/{search/sword}'
_controller: 'Search::search'
_action: 'search::search'
requirements:
- search/sword: '[^/=?]*'
defaultController: 'Search::search'
defaultAction: 'search::search'
At least this did work for me in TYPO3 v10.4.8 (without testing pagination or advanced search).
Rudy Gnodde is right: There is no 'page' parameter, so you don't need to configure it.
Just use following routeEnhancer to have an URL like www.domain.com/my-search-page/search where my-search-page is the page holding the indexed_search plugin.
routeEnhancers:
IndexedSearchPlugin:
type: Extbase
extension: IndexedSearch
plugin: Pi2
routes:
- routePath: '/search'
_controller: 'Search::search'
defaultController: 'Search::search'
I tried to use:
Behavoir >> URL Alias - "team"
and receive:
http://remax-prestige.pl/typo3-95/index.php?id=team
team is ok, but how I can receive the link without index.php?id=
You need to add a site in the Site Management module. When having a domain and path prefix, TYPO3 can make nice URLs.
You need to add TrailingSlash Settings in your Site Management config.yaml
routeEnhancers:
PageTypeSuffix:
type: PageType
default: '/'
suffix: '/'
index: ''
map:
'/': 0
'sitemap.xml': 1533906435
This works for me.
I'm trying to achieve the following via IIS:
Redirect requests for App-A to Server-A
Redirect requests for App-B to Server-B
Redirect everything else to Server-C
I have 1 & 2 working via simple redirect rules:
1.
Requested URL: Matches the pattern
Pattern: ^App-A
Action type: Redirect
Redirect URL: https://Server-A.fqdn/App-A
2.
Requested URL: Matches the pattern
Pattern: ^App-B
Action type: Redirect
Redirect URL: https://Server-B.fqdn/App-B
3.
I haven't sorted this one out yet.
The following is not working:
Requested URL: Does not match the pattern
Pattern: ^App-A, ^App-B
Action type: Redirect
Redirect URL: https://Server-C.fqdn/
Seems that the requested path is not preserved and appended to the redirect URL therefore the destination is unreachable.
3.
Requested URL: Matches the pattern
Pattern: ^(.*)
Action type: Redirect
Redirect URL: https://Server-C.fqdn/{R:0}
Since rules are processed in order, rule 3 is successfully processed for everything else ^(.*) when the request does not match rule 1 (/App-A) or rule 2 (/App-B). {R:0} preserves the path.
I'm done of installing calassification bundle wiht this error :
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "admin_sonata_classification_category_create" as such route does not exist.") in SonataAdminBundle:Block:block_admin_list.html.twig at line 39.
ps: I used this steps : https://sonata-project.org/bundles/classification/2-2/doc/reference/installation.html
On a new project, I encountered the same issue. I fixed it when I put below code in my routing.yml file
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
In addition to Alexandre T's answer: my complete routing.yml file looked like this.
admin_area:
resource: "#SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin