Speaking URLs in TYPO3 9.5 - typo3

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.

Related

TYPO3 v9 and up: How to enable disabled TYPO3 site language redirect without trailing slash

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.

Vue router - How to open in new tab in production?

I am using Vue, Vuetify and my database is in postgreSQL with an API-backend from postgREST (https://postgrest.org/en/stable/). When using the localhost and hash mode everything is fine locally. I can open the component product in a new tab when using this syntax:
const route = this.$router.resolve({ path: `/product/${value.id}` }) (1)
window.open(route.href, '_blank') (2)
However, in the production environment with postgREST-server when opening in a new tab, I get the wrong url :
http:server_name/api/#/product/1 (3)
When I remove /api from the above url (3) and rewrite it like this :
http:server_name/#/product (4)
I get the correct page.
Is it a possible nginx rule that can be written to make sure that
http:server_name/api/#/product/1 is automatically rewritten to the correct url http:server_name/#/product? or How can I change vue-router or vue config file in order to get same behavior in production as in locahost ?
A possible client-side workaround is to strip the /api prefix in production mode:
const url = process.env.NODE_ENV === 'production'
? route.href.replace('/api', '')
: route.href
window.open(url, '_blank')

TYPO3 v9.5.0 - Error message: Requested page does not exist /robots.txt

TYPO3 v9.5.0 - Error message: Requested page does not exist /robots.txt
I have a TYPO3 9.5.0LTS and use the bootstrap package theme. It seems to be all working ... but quite often I get such error messages:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1518472189: The requested page does not exist | TYPO3\CMS\Core\Error\Http\PageNotFoundException thrown in file /is/www/typo3_src-9.5.0/typo3/sysext/frontend/Classes/Controller/ErrorController.php in line 82. Requested URL: domain/robots.txt
What causes this and how to prevent this? Or how do I create a robots.txt in v.9.5 ?
In TYPO3 9.5 you can add a robots.txt in your Sites module.
Sites -> Choose your site -> Static Routes -> Create new.
Static Route Name: select "robots.txt"
Route Type: select "Static Text"
Static Text: Select "robots.txt Example Content"
Save. Should be fixed now.
This will work for all TYPO3 versions. For TYPO3 V9.x use the solution by Thomas Löffler.
Your server configuration (apache? .htaccess?) will hand over any request to a source that is no file and no directory and no symbolic link to the index.php file which is TYPO3.
In your case, you do not have a file robots.txt. So TYPO3 wants to handle it, but has no resource with that name. This creates a 404 error in TYPO3.
To prevent this, jst create the robots.txt file on your webserver in the DOCUMENT_ROOT folder
So what is a robots.txt file anyway.
This is a method to tell search engines how to behave on your server. It contains recomendations to the search engines' crawlers, when to stop crawling (like typo3_src folder). It is requested by the crawlers automatically and regularly.

Real URL's in Typo3 9.5.0

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

WooCommerce REST API "woocommerce_rest_cannot_view "

when i paste this link
http://localhost/wordpress/wp-json/wc/v2/products?consumer_key=ck_*******************&consumer_secret=cs_********************
it show for me this error message
{"code":"woocommerce_rest_cannot_view","message":"D\u00e9sol\u00e9, vous ne pouvez pas lister les ressources.","data":{"status":401}}
by the way the cosumers key & secret are correct
Your connection must be throw https
and add this lines to your woocommerce init :
{
....
verifySsl: false,
queryStringAuth: true
}
every post request require ssl
dublicate from this link
Ionic 3 WP-REST API Post request 401 (unauthorized) error
&
WooCommerce REST API "woocommerce_rest_cannot_view "
Here are 2 possible solutions:
Add the following variable in the index.php page of your WordPress installation (Worked for me on my localhost without having to restart the server):
$_SERVER['HTTPS'] = 'on'; //------> Add this line under the line that says: define( 'WP_USE_THEMES', true );
Set the environment variable in the .htaccess file when using Apache:
SetEnv HTTPS on
401 is unauthorized error
if key and secret are correct, it could be todo with SSL
other people report similar problems
https://github.com/woocommerce/woocommerce/issues/19649
Problem solved by adding this line below to the end of .htaccess file
All you need to add this line to .htaccess , this work with me
SetEnv HTTPS on
And make sure use OAuth 1.0 for Authorization
add false in end of creating RestAPI like this...
RestAPI rest = new RestAPI(URL, ConsumerKey, ConsumerSecret, false);
it should by "authorizedHeader"
answer from https://github.com/XiaoFaye/WooCommerce.NET/issues/211
None of the suggestions helped me, so I deleted my previous API credentials and created new ones. This made the change for me.
I don't want to say "just delete your credentials" as you have to make sure to not break any necessary connections, please note that! I'm just sharing my experience on this.