Questions tagged [redirection]

Redirection in Drupal means sending the users to a different page.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 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
1answer
12 views

Redirect logged in users to a verification page

We require our users to verify their phone numbers upon creation or number change. If there is no logged in user, they get redirected to the login page no matter what path they type into the browser. ...
0
votes
3answers
53 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
0answers
61 views

Why would redirected files create 404's at website's root? [closed]

When my Drupal 7 site was built (not by me), there was a schematic file field created within our "Tool" nodes to upload tool schematics PDF files with the file directory set to sites/default/files/...
-5
votes
0answers
32 views

Redirect URL using theme [closed]

The case of Drupal 8 How can redirect url using theme file. If user type "https://drupal.stackexchange.com/" then need redirect to https://drupal.stackexchange.com/home. Drupal 8. Simple i need ...
1
vote
1answer
68 views

Redirect from route when the controller has been changed [duplicate]

I'm trying to redirect to an external URL in a custom controller whenever I land on the 404 page. Right now I alter the controller destination in a route subscriber like this: public function ...
0
votes
0answers
41 views

Can I use KernelEvents::EXCEPTION to make exceptions for my own code?

I've written code for a custom module in my .MODULE file that looks like this. function cookie_authentication_node_access(NodeInterface $node, $op, AccountInterface $account) { if ($account->...
0
votes
1answer
23 views

Redirect to view display after form submission

I'm using a form_alter hook to add a custom submit callback. I want to redirect the user to a particular page display of a view. However, I'm having trouble figuring out how to specify the path. In ...
0
votes
1answer
47 views

How to get the uncached version of request headers?

We need to programmatically get the request headers using the mymodule_preprocess_page hook. To do this we tried the following, however, because we have CDN, Varnish, and Drupal Cache all enabled, the ...
0
votes
0answers
28 views

Redirect from a path

I have a routing.yml file with a path which triggers a controller method. When the controller method finishes the operation I want to return user to the page he came from originally. I don't want to ...
1
vote
1answer
38 views

Endless redirect on paths containing question marks

A similar question was posted here: EventSubscriber endless redirect But I haven't quite been able to implement a workable solution. On Drupal 8.73: Basically we have a custom module that is ...
0
votes
0answers
29 views

Can't go anywhere from user edit page after login

Having an issue with a certain user that is not reflected on other users, when this particular user is logging in he isn't redirected to homepage or to admin/dashboard but to user/edit page, ...
0
votes
0answers
19 views

How can we add header in redirect url just like adding header in curl

I am trying to call an external url from a drupal environment using RedirectResponse. In this request I need to add a custom header. I tried it using cURL and I got the custom header in the request ...
0
votes
0answers
30 views

How set a custom redirect confirmation path to webform programmatically

i'm trying to set a custom URL to redirect when the process of webform submit is completed without use the confirmation settings of webform. I Actually try with this: $entity->setSettingOverride('...
0
votes
0answers
20 views

Repointing a site a subdomain

I have created a new Drupal 8 site in a subdomain of an existing Drupal 6 site. The new site sits in public_html/dev - so the url for it is dev.mydomain.com. What is the best way to redirect ...
-1
votes
1answer
18 views

Redirect domain to www, but on subdomain do not use www

I have a multilanguage website. The main language is English and the second language is Spanish. I need to have all the traffic using this domains: English domain: www.example.com Spanish domain: es....
0
votes
0answers
16 views

When using /user/login as the default 403 access denied page, how can I add the tabs block to the login form?

After removing the anonymous permission to view published content, and setting the 403 access denied page to /user/login, the tabs block is no longer shown with the user login form. The tabs block ...
0
votes
0answers
48 views

User not logged in

I have a Drupal 8 installation and it is not logging in the users. Tried Google search and applied all solutions like setting cookie_domain, trusted_host_patterns and clearing cache. Note that, if ...
0
votes
1answer
70 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
0answers
60 views

How to stop a local database from launching the online website?

I'm a designer and new to Drupal. been studying for a couple of months creating sites for personal learning. I started working in a company that had a Drupal 7 website. I studied, learned it and ...
0
votes
1answer
28 views

Redirecting old file URLs (no pattern)

running Drupal 7.65. Our previous website manager moved us from Drupal 6 to Drupal 7 and cleaned up the file structure on our server. While all the files that are now on our website have clean and ...
-2
votes
2answers
77 views

How do I redirect a user to the front page after logging in? [closed]

Is there a way to redirect users to the front page after they log in, without using any additional modules other than the core modules. Right now they are redirected to their profiles.
0
votes
0answers
18 views

Non secure links redirect to homepage rather than serving over HTTPS

I have a site that is forcing HTTPS so that any links get redirected to being loaded securely if they aren't already so. For the most part, this works but there are a few links that work fine when ...
0
votes
0answers
23 views

Rules 301 redirect?

I have a rule which checks for URL segment and redirects to homepage. It works good but redirect is 302, not 301. Is it possible to use somehow 301 redirect or that can be achieved only via .htaccess?...
0
votes
0answers
52 views

How to redirect to the previous page after submission of a form in a block

I have a view of nodes of type task. I created a block with an inline task create form (using form block module) The block is next to the view on the same page. Question: After creating a new task by ...
0
votes
0answers
21 views

Execute some “code” when an external link is clicked

I'm very new to Drupal 8 and would really appreciate any advice about the best way to tackle my problem. I am creating an online video catalog that indexes videos from external vendors. All the videos ...
3
votes
1answer
173 views

Disabling Page Cache for Redirect Response

I've implemented a conditional redirect on my site via an event subscriber and returning a redirect response. It's working but, I believe due to the page_cache module is getting cached for anonymous ...
1
vote
0answers
26 views

404 not re-directing. Error: Call to a member function isSuccessful() on null

Having an issue with Drupal 8 not re-directing to our 404 page. The screen displays the ubiquitous "The website encountered an unexpected error. Please try again later." When I look in the recent ...
0
votes
0answers
22 views

Redirect old URL to new URL via htaccess with path

I am using HTTPS and WWW only rules in Drupal 7's .htaccess like: RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ensure https RewriteCond %{...
0
votes
1answer
92 views

How to use a RedirectResponse with a # (hash)?

I have this code: $event->setResponse(new RedirectResponse(base_path().'mypage#actions_clicker')); It redirects to /mypage, but it doesn not include the #actions_clicker part. How do I make ...
0
votes
0answers
38 views

id 'Redirect::create' status code optional?

I have a landing page generated from a social media account, at the landing page page 1 a backend decision is made, if a specific cookie is found they are taken to page 2, if it is not found they are ...
0
votes
1answer
43 views

Redirecting to a page based on the sub-domain

How can I redirect visitors to a specific page based on the sub-domain? For example: www.site.com goes to frontpage checklist.site.com goes to checklist.site.com/checklist My server is set to work ...
3
votes
1answer
249 views

How do I avoid caching a redirect response from a form?

I have a Drupal 8 form used by authenticated users which sometimes needs to redirect based on the presence of absence of something in session. I don't want the redirect to be cached. My form is ...
-1
votes
1answer
40 views

Getting redirect to phantom page /user/register/thankyou

In Drupal 8, I created a page with the path alias /user/register/thankyou to redirect users to after registration. Later, I changed the url of this page to simply be /register/user/thankyou. I have ...
1
vote
1answer
38 views

Links in stage environments are absolute and send users to live enviroment

This problem has been driving crazy for years. whenever I create a stage environment of a site, I copy the database from the production site. some of the links there - whether in the menus or in the ...
1
vote
0answers
27 views

Multiple sites in same subfolder

I have multiple very similar drupal sites (each for a specific year of some project): 2012.somain.tld, 2013.domain.tld, etc. Their files are organized in subdirectories (2012, 2013, etc.) of ...
0
votes
0answers
196 views

Is there a way to open redirected links in new tab?

I am using redirect module from my Drupal 8 website to some external website. Is there a way to force to open the redirected links in new tab?
0
votes
0answers
27 views

language redirect need more restricted control

I installed my drupal site with default English language. Then I added French language and change the default language to French, the original path following the domain thus append a parent path of /...
0
votes
1answer
28 views

What is the best way to forward visitors to my homepage to an external site but leave the backlinks accessible?

Maybe not distinctly a Drupal question, I have an older Drupal 7 site that I want to leave up for backlinks, but any new visitors I want to redirect to a new external website. So domain.com would ...
0
votes
1answer
198 views

Redirect to a specific page in ajax callback

How can I redirect to a specific page in an ajax callback using Drupal 7, I've already tested this method: function my_ajax_callback($form, &$form_state) { if (!user_is_anonymous()) { ...
2
votes
1answer
153 views

How to dynamically redirect user from /foo/X to /bar/X?

So far I did the following: I've installed Redirect and Token modules. I've applied the patch for Redirect module to support wildcards. I've applied the patch for Redirect module to implement ...
1
vote
1answer
164 views

How to find where are defined tokens for Redirect?

After enabling Token and Redirect modules, I've found at /admin/help/token that I can use Redirect tokens. For example: However, I've got the problem finding the place where and how these tokens are ...
2
votes
2answers
46 views

How do I display an error message on a basic page when the user does not have permissions to see the nested view inside the basic page?

I have a basic page, and inside of that basic page I have a view "newsletters". The view "newsletters" has permissions set on it based on role, so only admin and subscribers can see it. How can I ...
1
vote
3answers
1k 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
1answer
113 views

Error is raised when I try to redirect webform submission to external webpage with query string

Dear Drupal community, I created a webform using the webforms module in Drupal 8 in order to add information to a webpage. Since I don't want to update the webpage manually I'd like to automatize ...
1
vote
1answer
32 views

Alter menu link if logged in

I have a regular node in my main menu that: if an anonymous user clicks on it, the node should be shown regularly if a logged in user clicks on it, there should be a redirect to an external website ...
4
votes
1answer
1k views

How to redirect user page to front page for specific roles

I want to redirect every users page to front page? like if user page url is /user/97 then it redirect to front page if user is not administrator. I want user page inaccessible to other users but only ...
0
votes
1answer
132 views

How can I build a redirect from submitted form values?

I'm working on a short weather app. What I want to do, is to catch name of the input of city and redirect users to the city's page URL after submit. function form_findYourCity_submit($form, &$...
0
votes
1answer
249 views

Remove index.php from imported urls

I made some migration of pretty old website to d8. And urls ported fine from latest WP version: /user1/article-name1 /user2/2009/article-about-something /user3/2017/11/06/article-something But from ...
-2
votes
1answer
224 views

Redirect users to home page if already logged in

I am using a third party authentication mechanism to authenticate users. On successful authentication, I am able to redirect the users to the front page using the RedirectResponse class. If logged-in ...