Assuming I have PlayerProfile Component and I am using the following expression to allow user access this component:
[routerLink]="['PlayerProfile',{name:activity.user.username}]"
The URL is: http://localhost:3000/player-profile?name=My Name
But what if.. I want to make cleaner URL, like this:
http://localhost:3000/player-profile/My Name
What's the way to do it with angular 2 app? With my experience with web I tried to add the following into my .htaccess file:
RewriteRule ^player-profile/(.*)?$ player-profile&name=$1 [L]
but it's not working (shows an empty route component) and also everytime I will use RouterLink the browser will show the ?name=...
So, What's the right way to do it in Angular 2?
The router supports parameters
{path: 'player-profile/:name', component: PlayerProfile}
[routerLink]="['/player-profile/' + 'My Name']"
Related
I am trying to redirect using a button on a custom control (code below). the following is written to the debug toolbar which is where I want to go:
destBack=https://www.example.com/MyAttachments . But I instead get a Error 404 page and the following line appears on the server console:
HTTP Web Server: Item Not Found Exception [/site/home.nsf/https:/www.example.com/MyAttachments.xsp] Anonymous
I do have a reditection rule as follows:
Description: MyAttachmentsView
Type of rule: Redirection
Incoming URL pattern: */MyAttachments
Redirect to this URL: /site/home.nsf/MyProfileAttachmentsView.xsp
Send 301 Redirect:
If I copy and paste the destBack URL I get where I want to go.
My SSJS code behind the button is as follows
importPackage(com.example);
var destination = configBean.getValue("HostURL")+"MyAttachments";
dBar.info("destBack="+destination)
context.redirectToPage(destination)
Try this code to redirect
externalCtx = facesContext.getExternalContext();
externalCtx.redirect("http://www.tlcc.com");
See http://linqed.eu/2011/07/27/xpages-server-vs-client-side-redirects/
context.redirectToPage is designed to redirect the XPages runtime to an XPage within the current database. That's why the URL in the error message contains "/site/home.nsf/" (the current database path) and "https:/www.example.com/MyAttachments.xsp" (the URL you're defining).
If you want to change the whole URL, you need to change the URL client-side, not server-side, e.g. with location.href="...."
Im trying to combine several tutorials about Codeigniter and bootstrap and understand per codes so i can integrate it in my project. What i am trying to do right now is create a login form using the two framework.
And i setup my View according to the turotial included in Codeigniter 'user_guide/tutorial/static_pages.html' which my landing page is named as 'home.php' is inside the folder 'pages' and header.php, and footer.php is inside the 'templates' folder. I created also a controller: Page.php.
I also use .htaccess to hide 'index.php'. Now i follow this tutorial how to create a login page:
http://learnjquerybootstrap.blogspot.com/2015/01/login-session-using-codeigniter-and-bootstrap.html?m=1
-the only difference is this since i use htaccess:
<?php echo form_open(clogin/index); ?>
But when I try to submit the page i receive a: 404 page not found.
My navbar links are working fine. I understand that the codeigniter works like this:
http://localhost/myfolder/index.php/class/function/
so when i submit my form the url that show up is:
http://localhost/myfolder/clogin/index
and gives me: 404 page not found.
Question:
What is wrong with it?
is there something wrong with the tutorial that i am using? i check other tutorials and the controller structure is just the same, like on this link:
http://www.kodingmadesimple.com/2014/08/how-to-create-login-form-codeigniter-mysql-twitter-bootstrap.html
do i need to include clogin.php in route.php?
or is it about the htaccess? my
uri_protocol
is configured as
'REQUEST_URI'
in config.php. i tried other options but still the same.
Don't need include to route.
I recommented ready auth library.
If you use DevTools in your browser maybe "Network" tab of devtools can help you to why you get 404 error.
i already firgured it out.The mistake was in the route.php, since i tried to combine two examples.. i realized that the wildcard route that i included from the Codeigniter user guide will not work with the Clogin.php.
Since it was set as
$route['(:any)']='pages/view/$1';
So the url works as
http://localhost/myfolder/pages/view/clogin
instead of
http://localhost/myfolder/clogin.
I removed it and now it is working.
I want to have a clean URL in CodeIgniter based application for User's Profile Information.
Please Take a look at URL formats below.
Actual URL : http://www.mydomain.com/index.php/users/profile/user1
I'm expecting users to have Personal URL's like
http://www.mydomain.com/user1
http://www.mydomain.com/user2
http://www.mydomain.com/user3
URL http://www.mydomain.com/user1 should process http://www.mydomain.com/index.php/users/profile/user1 in background execution.
I will be removing index.php from URL using Route library.
Thanks in advance for any sort of help.
Have a look at https://www.codeigniter.com/user_guide/general/routing.html.
$route['user(:num)'] = "users/profile/user/$1";
If you mean you want /anyusername to route to the users controller, you would have to put:
$route['(:any)'] = "users/profile/$1";
At the bottom of routes.php and every non user-URL above it. Otherwise every URL would be routed there, obviously. You will need to implement some mechanism in the users-controller to throw 404-errors, since you are routing all requests not catched in the routing rules above.
IN config/routes.php
add this line
$route['user(:num)'] = "users/profile/$1";
I'm trying to make Symfony2 and Uploadify working together in a secured area.
(Uploadify is a flash/javascript component used to upload multiple files)
My uploadify component is working fine when the back-end script route is out of the secure area, but when in this area, I get a 302 HTTP error.
The log message is :
security.INFO: Authentication exception occurred; redirecting to authentication entry point (A Token was not found in the SecurityContext.)
While searching for an answer, I found that passing the PHPSESSID to the back-end script as a post parameter should work on "non-framework php" but with the Symfony Security Component, it seems that this script is not even reached.
Does anyone know if there is a way to send that token to the back-end script while keeping this script in the secure area ?
After having a read around the Symfony website, it's possible that this solution may work (haven't tested it). In your security.yml file, change your access_contol config option to something like this...
access_control:
- { path: ^/path/to/flash_component, roles: IS_AUTHENTICATED_ANONYMOUSLY }
Where /path/to/flash_component is the URL you are uploading to in Uploadify. Let me know if that works.
I'm developing my first facebook app on kohana 2.3.x at the moment and I noticed that a usual app url should look like this:
http://apps.facebook.com/{my_app}/{controller}/{method}
But in my app it shows the real url.
http://mydomain.com/{controller}/{method}
Any idea how to fix that in Kohana?
Thanks in advance!
Try changing this in application/config/config.php:
$config['site_domain'] = 'apps.facebook.com/my_app/';