Questions tagged [redirection]
Redirection in Drupal means sending the users to a different page.
848
questions
1
vote
1
answer
133
views
How can I programmatically trigger a 403 error with a hook implementation?
In a module within a drupal hook I'd like to conditionally trigger a 403 for the user.
I could archieve this e. g. by throwing an exception
throw new \Symfony\Component\HttpKernel\Exception\...
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 ...
0
votes
1
answer
790
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'...
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, ...
0
votes
2
answers
634
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/...
0
votes
1
answer
739
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 ...
1
vote
1
answer
515
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
645
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
566
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 ...
2
votes
2
answers
501
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
646
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
0
answers
50
views
Dev redirects to prod on every URL
I've got a dev version of a production site that seems complete and responsive, but when I navigate to that site in my browser it takes me to the prod site.
I have grepped every .htaccess file on the ...
0
votes
1
answer
648
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 ...
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 ...
18
votes
18
answers
33k
views
Redirect after user login
I would like to redirect users after they log in. Is it possible to use hook_user_login() to make the redirection? How do I add the parameter for the redirection?
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 ...
1
vote
2
answers
594
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'...
6
votes
8
answers
18k
views
How do I redirect users and show a message?
I want to redirect users with RedirectResponse and display a message, but the message is not displayed.
$response = new RedirectResponse($url);
$response->send();
After little debugging I found ...
1
vote
1
answer
983
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
38
views
Clearing cache via admin_toolbar results in white screen with "Redirects to external URLs are not allowed by default"
After pressing this admin_tool button to Flush all caches, the browser hangs on a white screen with the message: Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\...
0
votes
2
answers
66
views
How to do Do a redirect in buildForm()?
I send a link to a URL by email. This page is created with a controller which contains a form (FormAPI). I pass a token as a parameter to secure access to this form. So I check if this token exists ...
0
votes
1
answer
104
views
Show message after redirection
This will be mostly a Drupal question rather may not have any relation to Drupal commerce checkout.
I have an Offsite Checkout redirect payment method in which I have a buildRedirectFrom as stated in ...
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['...
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
$...
0
votes
1
answer
75
views
Website doesn't load properly from htdocs/web
Built a website on localhost, moved it to shared-hosting where webroot is htdocs but when visiting the website through the hosting's given IP address it obviously doesn't load the website, because the ...
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....
0
votes
1
answer
500
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, ...
-3
votes
2
answers
48
views
Using custom scheme (myapp://dashboard) in drupal simple-oauth2 module's redirect url
How can I use custom scheme i.e. myapp://dashboard for the redirect field of Drupal simple oauth2 module?
I get this error:
'myapp://dashboard is not a valid url'
I also tried to use the redirect ...
1
vote
1
answer
1k
views
Returning a custom command via AjaxResponse
I have a method that is invoked by AJAX call, and it returns an AjaxResponse. It redirects the user with RedirectCommand, added to the response. However, I would like to change it to a conditional ...
0
votes
1
answer
470
views
One site, two domains
We have a single site that we'd like to have two different domains: apply.school1.edu and apply.school2.edu.
The site is at apply.school1.edu and we'd simply like to create a domain apply.school2.edu ...
-3
votes
1
answer
59
views
I have deleted Redirect module and have lost alias-to-alias redirects as well as the ability to show aliases in some nodes
I uninstalled and removed the Redirect module using these commands.
vendor/bin/drush un redirect
composer remove drupal/redirect
This caused me to lose about 15 alias-to-alias redirects.
I have also ...
1
vote
2
answers
410
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 ...
2
votes
1
answer
766
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 ...
1
vote
1
answer
422
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 ...
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 ...
0
votes
1
answer
697
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
460
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 ...
1
vote
1
answer
455
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 ...
2
votes
2
answers
641
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 ...
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
144
views
Redirect directly to the payment provider page
I'm building a store with Drupal Commerce and creating my own off-site payment gateway.
On the review page, after selecting payment method, the user can click the button to pay and finish the order.
...
1
vote
0
answers
61
views
Contrib module service overriding not working
I am using the ‘Path Redirect Import module along with the Redirect module.
I am trying to override its service ‘path_redirect_import.importer’
To do this, I have added a service provider and a custom ...
2
votes
3
answers
3k
views
How to redirect a user to the current page?
How can I redirect user to the current page using Drupal\Core\Link?
I am creating a breadcrumb where I want to redirect user to the current page
0
votes
1
answer
83
views
Is there any danger in uninstalling Redirect module?
Drupal 9.5.3 with no core customizations and very few contrib modules:
Redirect
Asset Injector
Token
All nodes in this website have alternative aliases such as example.com/my-first-node instead of ...
0
votes
0
answers
131
views
Url-aliases or redirect without language prefix
How can I use url-aliases in additional languages without the language prefix?
From his old homebrew-CMS, my client has the following URLs:
example.com/english-page => redirecting to example.com/...
0
votes
0
answers
54
views
Website URL issue
I have an Drupal 10 installation on my Macbook Air. The web root is ~/Sites/drupal10/web. I have a hosts file entry pointing d10.mf.local to localhost and I have an Apache Vhost set up with ServerName ...
2
votes
2
answers
5k
views
Getting error 'Redirects to external URLs are not allowed by default'
Getting the error after created this .htacces in root folder.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/web
RewriteRule ^(.*)$ /web/
I want to redirect visitors to /web folder. I ...
1
vote
1
answer
83
views
Adding a view desktop link to mobile site
I am using X-AH-Mobile-Redirect in the settings.php file to redirect visitors to the mobile site. I need to add a link so that visitors can switch to the desktop site.
Here is a snippet of the ...
-3
votes
1
answer
42
views
Preventing one site from redirecting to www. prefix in multisite [closed]
I am using Drupal 9, multi-site. Generally, for all sites except one, i want to redirect from non-www to www prefix and i'm using the root .htacces file for it by uncommenting redirect rules. But the ...