Single Page App (ng2) and .htaccess - apache

Should be a pretty simple question but I have an NG2 app that will run an apache server, when navigating to the app url i.e. localhost:4200 it will check if the user is authenticated and if they arent authenticated it will redirect to the /login url. This works well but if a user refreshes the webpage on the /login url the app wont load (the base href is "/").
Should I setup a 301 redirect in my .htaccess to redirect hits to /login to /?

Related

How to redirect if direct access image by browser with Cloudflare?

How do I redirect if a user tries to direct access image files from browser only?
How to redirect from
https://img.example.com/c/600x1200_90_webp/img-master/img/2022/01/03/08/04/54/95259215_p0_master1200.jpg
to
https://example.com/detail?id=95259215
Is there anyway to do this with cloudflare? I can do this with nginx but if I have cloudflare enabled then the redirect won't work

htaccess won't redirect properly

Currently i'm working on a backend website admin but i have some trouble with redirecting. The issue is this when someone wants to edit a specific job function he needs to be redirected to for example: jobs/edit/Webdeveloper and in the PHP script it will send in an action to go to the edit page but when i redirecting it, it stays on the same page and does a simply refresh.
This is what i have as an link tag:
<a href='".$adminurl."/jobs/edit/".$list["function"]."'>Change</a>
And it works out like this domain.com/admin/jobs/edit/Webdeveloper
This is what i have in my .htaccess
RewriteRule ^jobs/change/(.*) jobs.php?&action=change&job=$1
What am i doing wrong here?

hybridauth: redirect URI is not whitelisted in the app

i am configuring single sign on feature with hybridauth plugin. It took me 2 days setup this. However, i am getting redirect uri error with facebook and google.
In google and facebook i have given website name like this http://example.com
i didn't found anywhere to put redirect url.
Now when i click on facebook or google. I am getting below error.
URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings.
Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.
Google error is below.
400. That’s an error.
Error: redirect_uri_mismatch
Login page exist on root and there is a folder i have created for hybridauth.
Inside that folder index.php file.
In config.php file. i have given baseurl like this.
"base_url" => "http://example.com/hybridauth/index.php",
I know this question doesn't have much code. But as per me issue with base_url and facebook/google oauth api.
You should be able to set Authorized redirect URIs on the provider's page. For example, on Google's Developer Console, you should be able to set the Authorized redirect URIs on the Credentials tab for your app:

redirect to appropriate URL based on bookmark

need to redirect to french url if user tries to access the application from default-f.aspx and redirect to the English URL if they come from default-e.aspx. Currently it redirects to English URL if they come from any bookmarked page from the app.

Onedrive SDK Authentication Redirect Issue with Query Param

Currently, I'm trying to integrate the OneDrive SDK onto a website. However, I'm having issue with redirecting with authentication.
Normal route:
User goes to the website. It clicks on a button to single sign onto there OneDrive
User gets redirected to OneDrive Authorization page.
Once authentication, user gets redirected to where they left off. This redirect is specified in the OneDrive's SDK account. However, it seems that they don't allow query params in the redirect URL.
Is there a way around this?
The only thing I could figure out is using a URL that is an alias for the URL with the query params, but that just seems like a hack solution. It's hard to believe that there isn't a way for a user to redirect with query params to indicate at what stage they left off on the site.
Example of invalid redirect url as http://skydpk.com/index.php?a=ap&addon=file_sharing&page=skydrive
Any advice appreciated,
Thanks,
D
You can try registering your base URL as the redirect URL and just before initiating authorization action append the parameters to the redirect URL.
Redirect URL at one drive app dashboard : http://skydpk.com/index.php
Authorization URL
https://login.live.com/oauth20_authorize.srf?client_id=<your client id>&scope=<scope>&response_type=code&redirect_uri=http://skydpk.com/index.php?a=ap&addon=file_sharing&page=skydrive