I have Spartacus multi site configuration as below,
B2cStorefrontModule.withConfig({
context: {
countryLang: [
'te-te',
'ca-gn'
],
}
When entering URL https://localhost.com:4200/ca-gn, it redirects to https://localhost.com:4200/ca-gn/.
Here trailing slash getting added automatically.
I have below requirement,
If I'm entering URL https://localhost.com:4200/ca-gn it should remain at same URL.
If I'm entering URL https://localhost.com:4200/ca-gn/ it should redirects to https://localhost.com:4200/ca-gn.
It looks Spartacus default behavior.
Is there any possibilities to get this overwritten for my expected behavior?
Related
Is it possible to add trailing slash to root URL?
For example, I need https://domain.example -> https://domain.example/
https://domain.example and https://domain.example/ are the same URL - there is always a slash immediately after the hostname (at the start of the URL-path), even if you do not see it in the browser's address bar (it is present in the HTTP request).
The browser "prettifies" the URL you see in the address bar - this is not necessarily the exact URL that the browser uses in the request.
See the following question on the Webmasters stack:
https://webmasters.stackexchange.com/questions/35643/is-trailing-slash-automagically-added-on-click-of-home-page-url-in-browser
I have generated my WordPress website as static html and deployed it to s3 bucket to serve as static website.
Here is my website endpoint: wwwalls.com
My SEO team wants that the page URLs must not contain trailing slashes, but I could not find any document online that could allow me to get rid of trailing slashes from the URL eg : https://wwwalls.com/demo leads to https://wwwalls.com/demo/
I tried using redirects but then it ends up in too many redirects.
[
{
"Condition": {
"KeyPrefixEquals": "demo/"
},
"Redirect": {
"ReplaceKeyPrefixWith": "demo"
}
}
]
Please advice !
All extensionless URLs on the site, which resolve to the actual nodes, are being redirected (with 301 code) to their versions with added trailing slash. It doubles amount of requests to the frontend web server so we would like to fix this.
We do use Apache mod_rewrite to rewrite all incoming URLs (with or without slash) to their .html equivalents in order to make dispatcher caching consistent, but the actual processing is a bit weird.
In general, we have three cases:
URL has an extension ( i.e. /content/xxx/yyy.html ) - it's being processed right away, no redirects
URL has trailing slash ( /content/xxx/yyy/ ) - it is processed by mod_rewrite and rewritten to /content/xxx/yyy.html successfully. no redirects
Extensionless URL ( /content/xxx/yyy ) - processed by mod_rewrite, rewritten to /content/xxx/yyy.html and immediately redirected to /content/xxx/yyy/ which is subsequently goes through the routine from the point 2 above.
To exclude Apache originated redirects we disabled almost all modules, such as mod_dir, mod_negotiation, mod_autoindex, etc to avoid redirects due to the content negotiation or directory indexing but requests are still being redirected.
Our app doesn't contain any redirects based on the URL so I'm wondering if there is any OSGI service or hidden configuration setting which triggers such redirects?
We also have a set of shortcuts on the site, Apache rewrites them to actual URLs and they are NOT being redirected.
For example, if requesting URL is /aboutus it's being successfully mapped to the /content/xxx/yyy/operations/aboutus.html and processed in one loop without any additional redirects. The problem described above is valid only there is an actual corresponding node in JCR and request is extensionless.
I just notice if we append "#anydomain.com" to any URL Chrome (and also FF) redirects user to the domains appended.
For example:
http://www.google.com#facebook.com/ - Will redirect to facebook.com
http://www.facebook.com#google.com/ - Will redirect to google.com
I would like to prevent it from my website, does anyone know anything about it?
Thanks in advance!
-B.J.
Adding more info:
If I try to add a '/' before the '#', like this:
http://www.google.com/#facebook.com/
Then Google gives me 404 page not found... But my website still redirects with the '/'
The # symbol is used as part of the URI scheme to login users to a site.
If you notice, as soon as you click it says "You are about to log in Facebook.com with the username..."
Its part of the HTTP protocol. You can't really do anything about it.
Read : http://en.wikipedia.org/wiki/URI_scheme
I fix it.
The issue was in the Apache configuration, the permanent redirect I have to redirect from HTTP to HTTPS had the wrong template, it was missing a final slash '/'.
So when accessing:
http://mydomain.com/#anotherdomain.com
it was redirecting to https://mydomain.com#anotherdomain.com without the final slash, and the browser default behaviour was to redirect to anotherdomain.com without even hitting my server.
It was only about adding the slash on the redirect clause I have.
Redirect permanent https://mydomain.com/
I'm using Options –Indexes in a .htaccess file in the directory I want to disable listing, but still when I go to the directory I can see all the files in that directory. What am I doing wrong? (Apache server).
Is it possible you have DirectorySlash turned off? It makes it so requests for directories that are missing the trailing slash gets redirected to the same directory with the trailing slash. By default it is on, but if it's turned off, it has a strange side effect that allows listing of directories regardless of the Indexes options:
Turning off the trailing slash redirect may result in an information disclosure. Consider a situation where mod_autoindex is active (Options +Indexes) and DirectoryIndex is set to a valid resource (say, index.html) and there's no other special handler defined for that URL. In this case a request with a trailing slash would show the index.html file. But a request without trailing slash would list the directory contents.