I'm trying to do an internal redirect in AEM 6.3, what I'm trying to do is: any request coming to localhost:4502/aem should be redirected to localhost:4502/content/myapp/en/login.html. So I created a sling:mapping node under /etc/map/http/:
jcr:primaryType="sling:Mapping"
sling:internalRedirect=/content/myapp/en/login.html -> Type String
sling:match=localhost.4502/aem -> Type String
I'm getting an Internal Server Error: Cannot serve request to /aem on this server. But if I add the .html suffix (request to localhost:4502/aem.html it works and redirects correctly.
Also tried:
sling:match=localhost.4502/aem(.*)(/.*)?
I wonder what I'm missing/doing wrong. Thanks in advance for your help.
I solve it using sling:redirect instead of sling:internalRedirect, not sure if this is the proper solution, but is working:
jcr:primaryType="sling:Mapping"
sling:redirect=localhost:4502/content/myapp/en/login.html -> Type String
sling:match=localhost.4502/aem -> Type String
If you have a better option, feel free posting it, Thanks.
I would recommend you go to http://localhost:4502/system/console/jcrresolver to check whether your redirects are correct or incorrect!
for example your
CRXDE Internal URL is http://localhost:4502/content/app1/en-in/home.html
and preferred external URL is http://localhost:4502/home/
There are to options you will be able to see
map:
map returns you the external URL when you enter internal URL. Remember to add .html at the end.
resolve:
resolve does the reverse of map. Remember to add .html at the end while testing.
Related
On this website :
https://lessentiel.novethic.fr/blog/business-case-3/post/orpea-dialogue-de-sourds-face-a-lengagement-actionnarial-des-acteurs-de-la-finance-durable-810#scrollTop=0
Google Analytics add parameters for cross-domain-tracking to url so a working link like this one
https://www.novethic.fr/actualite/gouvernance-dentreprise/entreprises-controversees/isr-rse/les-sombres-dessous-d-orpea-ont-echappe-aux-filets-de-la-notation-rse-150534.html
become this, that lead to 404 error
https://www.novethic.fr/actualite/gouvernance-dentreprise/entreprises-controversees/isr-rse/les-sombres-dessous-d-orpea-ont-echappe-aux-filets-de-la-notation-rse-150534.html?_gl=1*1rw78bk*_ga*ODIzMDE2MTIuMTYzODE5MjUyMw..*_ga_FVLX79JNXC*MTY0NDQ4NjM1OC40OC4xLjE2NDQ0ODg2MDkuMA..#_ga=2.179165860.1898940241.1644433835-82301612.1638192523
Any tell TYPO3/ RealURL to ignore cross-domain-tracking parameters ?
_gl=11rw78bk_gaODIzMDE2MTIuMTYzODE5MjUyMw.._ga_FVLX79JNXC*MTY0NDQ4NjM1OC40OC4xLjE2NDQ0ODg2MDkuMA..#_ga=2.179165860.1898940241.1644433835-82301612.1638192523
Take a look into configuration what is set for the settings:
$GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters']
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError']
In pageNotFoundOnCHashError you can define if the system throws a 404 when cHash parameters are not valid e.g. when a parameter was added but not handled in cHash. This is happening when an external service adds parameter like Google does in your case.
In cHashExcludedParameters you can define the parameters that are not used to validate the cHash.
There are 2 options now:
Set pageNotFoundOnCHashError to 0 (not so good solution as there won't be a 404 when someone tries to manipulate the parameters)
Add _gl to the list of cHashExcludedParameters (better solution as you whitelist the Google parameter and keep your system safe)
I am using a the emicklei/go-restful framework to deal with rest API.
I wish to access the route path from the request. Meaning that when I configure a dummy route like this:
ws := new(restful.WebService)
ws.Path("/resources/names")
ws.Route(ws.GET("/{name}").To(getName))
restful.DefaultContainer.Add(ws)
I wish to access the information that the route was "/resources/names/{name}"
I can access the actual URL which is call by calling:
req.Request.URL.Path
But this will return the specific URL, not the generic one.
Any suggestion?
After more research I finally found that the method req.SelectedRoutePath() will return expected value.
I have a use case to redirect /content/project/en/test/events to /content/project/en/test page as internal redirection of page properties is not working .
I used following values under /etc/map/http folder :
sling:match as (.+)/en/test/(.+)$
sling:internalRedirect as (.+)/en/test.html
Still my required redirection is not working .
Please let me know correct configuration for the same .
Thanks&Regards.
The sling:internalRedirect is the target to which user is taken so you should use in it the match from the sling:match
use: sling:internalRedirect as $1/en/test.html
btw. there's a useful article about mappings here: https://www.cognifide.com/our-blogs/cq/multidomain-cq-mappings-and-apache-configuration/
EDIT:
a simple config like this will work (redirect from home.html to page1.html):
Good day
I am writing a module for Nginx, that should redirect user to certain (local) URLs, if several conditions apply - something like ngx_http_rewrite_module (Though I couldn't find redirection code in that module).
My code successfully runs on required events, but I am unable to redirect user to another page.
I've tried ngx_http_internal_redirect, but it didn't work:
static ngx_str_t ngx_redirect_script = ngx_string("/dst.php");
return ngx_http_internal_redirect(r, &ngx_redirect_script , &r->args);
Perhaps somebody knows how to do that?
Thank you!
Interesting, this worked:
ngx_http_internal_redirect(r, &ngx_redirect_script , &r->args);
return NGX_HTTP_OK;
I am using Mason 1.0 and want to redirect the page to another URL.
Is there any way to redirect?
Alternatively...
I have written following code in dbhandler which is giving error, stating that $r is undefined. Can you please help.
$r->method('GET');
$r->headers_in->unset('Content-length');
$r->content_type('text/html');
$r->header_out('Location' => $newPageURL);
$m->abort(301);
I cannot use $m->redirect as it is not avalible to me.
I am referring to this link http://www.masonhq.com/htmlmason/wiki/FAQ:HTTPAndHTML on the section "How do I do an external redirect?"
$r->status(302);
$r->headers_out()->add("Location", "http://google.com");
return 302;
Looks like $m->clear_buffer is missing before your first call.
It's required so it wipes out any response generated before you reach your redirection.