htaccess redirect to query string - .htaccess

I use an e-commerce service called Ecwid. I've set up my site so that i can avoid ecwids default storefront. But i still need to access the shopping cart. I want to prevent customers from access the default storfront and be redirected to the shopping cart.
From: https://example.com/store.html
To: https://example.com/store.html?store-page=cart

Related

Can we set Redirect URI dynamically or set Redirect URI at runtime if it is not added already in the Stripe Connect Account?

I have a site with dynamic URLs, Now I want to set the Redirect URL in stripe standard account at runtime. I mean, For now, I am compelled to go to my account settings to redirect URL, is there any way we can add new redirect URLs using some API?
One way to solve this is to use the state property when you create an authorize link. This will be passed through the OAuth process.
https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_123&scope=read_write&state=special-value
When the user is redirected back to your site, you can grab the state value from the query string (special-value in my example) and then use that to help determine where to redirect the user to a final destination page after you fetch the user's credentials.

Hybris redirect from a cmssite to another cmssite

I have b2c and b2b site. When a b2b customer logs out it should be redirected to b2c site homepage.
I tried below. It works for other sites like "www.google.com" but redirecting to another cmssite doesn't work.
httpResponse.sendRedirect(encodedRedirectUrl);
Also I tried setting target cmssite to currentSite before redirect but no luck
I believe the session site and other parameters are not cleared from current site or populated for target site. Guide me the right way to do it.
There are two things you need to know about CMS sites and the session:
When you access a hybris storefront for the first time, hybris determines the CMS site for this specific request. The request is matched against the URL pattern in your CMS sites. The first CMS site that has a pattern that matches is put into the session. Also the corresponding catalogs are set and so on.
When a CMS site is set in session the process from 1. is not undertaken anymore. Every request that arrives will be associated with the CMS site from the session.
What you need to do is:
Either:
Clear the CMS site from the session BEFORE doing the redirect, so the CMS site filter is forced to determine the CMS site once again.
OR:
Replace the b2b site with the b2c CMS site in the session when logging off. Then do the redirect.
Check these classes:
my.storefront.filters.cms.CMSSiteFilter
especially the method: processNormalRequest
de.hybris.platform.acceleratorcms.context.impl.DefaultContextInformationLoader#initializeSiteFromRequest

Liferay Custom landing page or last path?

User A ----> has "XYZ" role and has "ABC" as home site User B ---->
has "PQR" role and has "DEF" as home site
Whenever user A logs in I need to redirect him to site "ABC" rather than default guest site.
Whenever user B logs in I need to redirect him to site "DEF" rather than default guest site.
Through hook I have achieved this
hook property:
login.events.post=com.mytest.portal.events.MyLoginPostAction
And then in MyLoginPostAction I have checked the user role and then redirected him to corresponding site.
Now, say user A has subscribed to the blog on any of the site. He receives an emaial containing link to that Blog.
User A is logged out and then he tries to reach that Blog with direct link. Since user A is not logged in, he is redirected to login page.
On log in he is redirected to site "ABC" rather than going to that Blog. This is due to I am redirecting User to home site.
So how can I achieve this scenarioes i.e when user try to access that Blog page when not logged in then on log in he should go to that blog page and when user just try to log in to portal then he should redirect to home site.
You can get lastpath object in your action class by
request.getSession().getAttribute("LAST_PATH")
And based on path value from lastpath object, you can determine where to redirect.
By necessary login by direct link, Liferay set the forward path as url parameter. May be you can read the redirect parameter from request and decide to forward to specific page or not.

Setting landing page for different users

I am Using Liferay 6.1CE.
I can able to set my default landing page to a site in control panel.
But in my portal 2 sites are there,two users are there.
For eg: userA is a member of siteA,simularly UserB member of siteB.
How can i redirect the users to their site after login.
What can i do?
I guess 2 sites you mean two communities. Anyway you need to create post login action where you'll check your conditions and redirect where needed.
You can create the Liferay hook for your custom login post action. Please have a look at :
custom action using hook
on how to create the hook.
In the hook, you can identify the looged in user based on your search criteria and redirect to the relevant community.

Changing the default page based on security group in SharePoint

We have a SharePoint site collection. In this site collection we have a home site and 6 other sites. Each of these sites belongs to a department in our company. Right now if you are a member of department A security group you would see homepage and your department site/tab when you navigate to the site. What they want me to do is to redirect the users directly to the department site/tab whenever they navigate to the site.
Is there any way to do this without coding or with coding?
With coding, you could write a very simple web control and include that on the home page. It would test which group a user belongs to and then redirect accordingly.
There are various ways to check if a user belongs to a group. One method is to get a reference to each SPGroup object and use SPGroup.ContainsCurrentUser.
You might also like to consider creating a custom list that maps SPGroup name against department URL, so you can manage behaviour of the control through the SharePoint UI.

Resources