Questions tagged [redirection]
Redirection in Drupal means sending the users to a different page.
835
questions
0
votes
0
answers
11
views
Fetch redirect alias using the old alias
I want to get the current alias of the node using an old alias. I do have the Redirect module installed and all the old aliases of the nodes are mapped to the new ones. But I am not able to fetch the ...
0
votes
1
answer
621
views
Redirect user after one-time-login
When users get an email with one time login link, they will arrive on a page to set their password (separated form via Password Separate Form)
But once they click submit, it doesn't redirect them to ...
0
votes
1
answer
556
views
Is it possible to change the form submit handler from within a validate handler (need to redirect to another form depending on values entered)
I have an initial webform (based on 3.x of webform module/Drupal 7) that needs to redirect to a second form if yes is specified in a yes/no choice. Otherwise if No, the first form should submit ...
4
votes
4
answers
6k
views
How can I redirect node page for a content type to custom URL?
I need to redirect all the pages for a content type to a custom URL in Drupal 8.
I used to do this in Drupal 7 by implementing hook_init() with the function drupal_goto() or by using the Rules module....
2
votes
2
answers
500
views
How to redirect to a different URL based on node content while loading a node
I have a site that uses the webforms module to gather user information. On the front page there is a list of previous submissions. Each of which has a link to view the submission (generated by Views ...
1
vote
1
answer
505
views
Form submit POST renders page before submit handler is called
I have a search form in the header that is simply adding a search term to the current URL. If you are on example.com/list-page and submit a search, it just sends you to example.com/list-page?search=my-...
1
vote
1
answer
592
views
Domain Access Login Redirect for main domain and subdomain
I have created three sites namely one.example.com, two.example.com, three.example.com using domain access. Here one.example.com is the main site which can create n number of subdomains. I want to ...
0
votes
3
answers
883
views
How to redirect a user on login?
I have a registration form, when submitted, the user gets logged in automatically.
I want to redirect the users to a specific page on login. Whether they are logged in using the login form or through ...
1
vote
1
answer
618
views
Redirect the title field of a content type to some external url in a view
I am using drupal 7 with view3
I have content type named News having many fields along with a taxonomy field named News Type, News type have terms: 'Free' and 'Premium', I am displaying News on my ...
0
votes
1
answer
54
views
Stripe doesn't see API key after TrustedRedirectResponse
I have a controller that calls the Stripe API using stripe-php to create a checkout session.
/**
* Checkout using Stripe.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* ...
0
votes
1
answer
42
views
How to redirect custom ajax form to external url with headers
When setting the form with ajax handler like this
public function buildForm(array $form, FormStateInterface $form_state) {
//...
$form['actions']['submit'] = array(
//...
'#ajax'...
9
votes
3
answers
4k
views
TrustedResponseRedirect failing - how to prevent cache metadata?
I am getting the following when trying to redirect to an external site from my controller function defined in my routing file:
return new TrustedRedirectResponse($my_ext_url);
LogicException: The ...
0
votes
3
answers
5k
views
How to do a redirect in node.html.twig?
I'm trying to do a redirect on my node.html.twig template based on the content type because I'm using views for my content.
I tried this:
{% do redirect('/example') %}
or this:
{% redirect '/...
0
votes
0
answers
10
views
onNotify called 3 times on error returned
I'm using the OffsetRedirect.php file to handle the return of my bank when the user pay his order.
Inside this file, i use the onNotify() method
public function onNotify(Request $request)
{
$...
2
votes
1
answer
590
views
Get path from router and redirect after autocomplete selection
I have a form that is inflated inside a box. In that form I have an autocomplete field. I want to allow the user, when they select an item from the autocomplete's suggestions they are automatically ...
0
votes
1
answer
1k
views
Add uid to existing menu link
I have a custom menu MyMenu and I have four menu items.
What I want to do is to add the current uid as a parameter at the end of the link.
In D7 I could use menu_tokens module which is not available ...
0
votes
0
answers
38
views
How can we redirect from a node's /latest URL if there is no latest moderation state when the user clicks it?
Drupal 9: We want to link users to the node's "/latest" URL but if there is not currently a latest version then they get an access denied message. We'd like to, instead, redirect the user to ...
0
votes
0
answers
35
views
Keep page published or unpublish?
Such a simple question I'm sure, but I can't find anything anywhere on this. I ran lots of tests - if the page is deleted the redirect doesn't work, but whether I unnpublish or keep the page published ...
0
votes
1
answer
638
views
Redirect a view page to another view page with arguments in the url
I have a custom view with button in the main tab placed in the local_task tab bar area (Outcomes). I have sub local_task navigation items under that as well that are regular drupal views. (See below)
...
4
votes
1
answer
1k
views
How to implement StackMiddleware for a redirection correctly?
I'm working on a redirection (for unauthenticated users) for my Drupal 8 site. Currently, the redirection works however, the redirection persists even after user is authenticated. I found this article ...
1
vote
2
answers
521
views
Redirect to anchor after form validation
I am trying to redirect users to the anchor of the error form field after form validation.
In the form I set the form validation handler with the following code.
$form['#validate'] = 'my_form_validate'...
0
votes
2
answers
2k
views
Redirect Using Rules Based on Account Role
Further to this previous question, https://drupal.stackexchange.com/questions/1790/redirect-users-after-login-depending-on-the-users-roles I am trying to accomplish a similar redirect on a D7 whereby ...
1
vote
1
answer
944
views
Sending data via post and redirecting user
So I made a module that needs to gather some data and redirect user and that data to a payment site.
function payment_upload_form($form, &$form_state){
$form = array();
$form['#action'] = '...
0
votes
1
answer
767
views
ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY'
When importing a dump from a production site with mysql in a xampp environment I got this error:
ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY'
These lines are affected:
ALTER TABLE `...
1
vote
1
answer
64
views
How to redirect to a specific page after submitting password reset?
When a logged in user resets their password at /user/password and clicks the submit button, they are being redirected to the frontpage.
How can I redirect to /user instead?
I've tried the second ...
3
votes
2
answers
1k
views
Why is redirect after login not working?
I use Ctools Modal to show the login form to users in an overlay. If a user enters right data then he is logged in and the page is refreshed.
The code:
function login_overlay_menu() {
$items['...
12
votes
4
answers
4k
views
How include hash (#) in drupal_goto path?
Is there any way to include a # in drupal_goto?
i want something like this
function MYMODULE_preprocess_node(&$variables) {
$node = $variables['node'];
switch ($node->type) {
case '...
0
votes
2
answers
2k
views
Redirect user to previous page after registration
I'd like users registering on my website are redirected to the page where they clicked the "create account" button which is in a modal.
First, I tried to redirect to an absolute url
I tried
$...
1
vote
1
answer
810
views
Trouble sending redirect after logout
I'm trying to send a redirect after logout, but it is not sending properly. I tried using the hook_user_logout in a module as follows:
use Drupal\Core\Routing\TrustedRedirectResponse;
function ...
1
vote
1
answer
2k
views
How do I redirect to a route with POST method?
I want to redirect to a route and also want to send some parameters which I don't want to expose on URL.
So, I need to redirect with a post method. How to do this?
$form_state->setRedirect('route....
1
vote
1
answer
2k
views
drupal_goto in new tab
Shortly: How can I open a drupal_goto() result in a new tab?
More details:
I've got a list of news, made with Views, that can be imported from a RSS feed (big custom module, very complicated, etc, ...
0
votes
1
answer
494
views
How to redirect into a specific page variant
I installed panels, page manager, ctools and page manager redirect.
I made a (panel) page say foo1
- admin/structure/pages/add with variant type Panel. In this I put 5 variants named foo1variant1, ...
0
votes
2
answers
1k
views
How to disable redirection to the node after node form submission
I have a node form exposed in the front-end to allow visitors to add their organisation to the list of partners. Below the form, I have exposed view block with the list of existing partners.
When a ...
1
vote
2
answers
371
views
Is there a way to add a persistent querystring across multiple pages?
I want to add a persistent query string to pages once it is introduced (for the context module to maintain a page layout inside an iframe). At the moment, I'm checking the http referer for the string ...
1
vote
1
answer
419
views
Redirect user to language other than default
So... i have set a drupal website with 2 languages, english (default) and portuguese. At some point during development the client asked me to change the default language to portuguese but as i've read ...
1
vote
1
answer
429
views
Locked out of the site, and new users can't get in
I have an odd problem. My new Drupal 8 site is a distro, purchased from ThemeForest. After installing it, I thought I created a new user correctly but maybe the name had disallowed characters. In any ...
0
votes
1
answer
624
views
Trigger redirect after Webform Remote Post Handler posted successfully
I've made a webform with a handler. This handler does a Remote Post towards an API. This API is actually a custom module within the Drupal install which (after some logic) passes all of the ...
1
vote
1
answer
445
views
How do I redirect the unsubscribe link in a newsletter to a particular node?
I am using the Simplenews module for sending newsletters, and the Mandrill service for sending emails. When I send a test newsletter to the test user, the unsubscribe link should be redirected to ...
1
vote
2
answers
1k
views
Redirect to 404 page, if the path alias doesn't exist
I am developing a multilingual site in Drupal 8. I added content in Turkish and I didn't create any translation for that node.
I managed to redirect user to the path alias. For example, when users ...
2
votes
1
answer
711
views
Redirect module does not allow redirection for existing node's path alias
I installed fresh Drupal 8 and after that the Redirect module with proper settings. After adding the redirect rule for a path alias it does not work but it saves data properly into the database.
But ...
0
votes
2
answers
612
views
Switch site language after IP to locale redirect
I have a Multilingual Drupal 7 website. using i18. I redirect my visitors based on IP address with IP to locale module. Now e.g. visitors from Holland (Dutch IP) are redirected to http://landberg.at/...
1
vote
2
answers
2k
views
Displaying the submitted values in a table
I created a custom form and after the form is submitted I need to display the submitted data in a table. This seems like a very simple problem. I am able to use dpm() and drupal_set_message() to ...
1
vote
1
answer
1k
views
Redirect taxonomy term page links to a View page's exposed filter
I'm trying to make every taxonomy term page link direct to a pattern like this:
/viewpage?[term:vocabulary][]=[[term:tid]]
So, for example instead of material/bronze where bronze has term id 7, ...
2
votes
2
answers
873
views
Redirect to a view with contextual filters
I would like to redirect the user to a view with some contextual filters on the submit of a custom form.
For now I use this :
$form_state->setRedirect('view.search.page_1', ['myvalue' => $...
1
vote
1
answer
55
views
Redirect user to a custom page after one time login
If my user click to "forgot password", and email with a one-time login is sended.
When the user clicks the given link, he's redirected to this page /user/reset/$id with the user_pass_reset ...
2
votes
2
answers
198
views
Redirect doesn't work for .pdf file
Is it possible to create a redirect for documents using the Redirect module? I can't seem to find a solid answer. Basically I'm just trying to create a redirect from https://www.example.com/default/...
0
votes
1
answer
169
views
redirection in htaccess file
I'm working on Drupal7.
I want to redirect all the URl's to external domain except some.
Below rewrite I have added in .htaccess file and its working fine.
RewriteCond %{REQUEST_URI} !/user.*$
...
0
votes
1
answer
51
views
Custom alias for home page
I have a bilingual website (French and English)
I have set
"/fr/nom-de-page" as the home page in /fr/admin/config/system/site-information
But Drupal 9.4.5 insist on redirecting to /fr/
I ...
20
votes
7
answers
47k
views
Redirect after form submission
I created a custom form in Drupal 8. I remember we can redirect to custom path in Drupal 7 with $form_state['redirect'] = 'mycustompath'; in a submission handler.
How can I achieve the same in Drupal ...
0
votes
0
answers
61
views
How do I redirect users after login without using contributed modules?
We have to upgrade Drupal 8.9 to Drupal 9.3.3; since the login_destination module stop working, and we don't know why, I've tried others modules like Anonymous Login, Redirect After Login, User ...