Nginx proxy 302 redirect location header is wrong

I have a problem with getting Nginx proxy to work with Mautic instance, the website works like that(I swapped all urls to https://mautic.example):

When you visit https://mautic.example, you get redirected to /s/login. After logging in, browsers sends POST to /s/login_check, gets 302 found and location header, then browser sends GET to location header URL.
In original server the location header is https://mautic.example/s/dashboard. On proxy it’s /s/login which does nothing else but refreshes the page because the user is already on /s/login.

I want simplest proxy possible.

Here is configuration I tried:

server {
    listen 8091;

    location / {
       proxy_pass https://mautic.example;
   
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "Upgrade";
     }

}

What am I missing here?

8 – Redirect domainname from non-www to www in settings.php in combination with https

Because the .htaccess gets overwritten when you update your Drupal Core, I found an other way to implement redirection to https. In settings.php. But below function does not redirect non-www to www.
I would like to extend this function so all domains without www are redirected to www.domain.com.

Below function was found on: https://www.drupal.org/https-information

if ( (!array_key_exists('HTTPS', $_SERVER)) && (PHP_SAPI !== 'cli') ) {
  if (substr($_SERVER('HTTP_HOST'), 0, 4) <> 'www.') {
    $new_url = 'www.' . $_SERVER('HTTP_HOST');
  } else {
    $new_url = $_SERVER('HTTP_HOST');
  }
  $new_url .= $_SERVER('REQUEST_URI');

  header('HTTP/1.1 301 Moved Permanently');
  header('Location: https://'. $new_url);
  exit();
}

With above function:

http://www.mydomain.com redirect to https://www.mydomain.com ==> OK

http://mydomain.com redirect to https://mydomain.com ==> Not OK

I want:

http://mydomain.com or https://mydomain.com to https://www.mydomain.com

Hope this helps.

How to do a redirect from Categories

Guys,
hope you all can understand what i mean here.

let’s say currently I have these catergories, shop , store.

If I wanna remove all items means all the urls in the shop on my site , do a Redirect to Store which is another menu
SEMrush

how to go about it? means when people happen search the shop link on my sites any items before they will redirect to my store

i was preferring both shop and store under the Same site

 

Redirect manager | NulledTeam UnderGround

Description:

Allows redirecting old URLs to new URLs.

(Example of Redirect manager)

pic001.jpg

(Example of User group permissions)

pic002.jpg

Features:

All phrases start with redirectmanager_ for your convenience.

How to use:

Add ‘redirectmanger’ to your forum URL.

Database changes:

Adds a table called…

.(tagsToTranslate)nulled(t)nulled sites(t)nulled forum(t)nulled script(t)nulled scripts(t)nulled script forum(t)best nulled scripts site(t)xenforo nulled(t)xenforo 2 nulled(t)xenforo nulled themes(t)seo xenforo 2(t)xenforo themes(t)seo for xenforo(t)vbulletin nulled(t)vbulletin 5 nulled(t)whmcs nulled(t)hexa whmcs(t)whmcs addons nulled(t)whmcs templates nulled(t)whmcs template nulled(t)whmcs modules nulled(t)whmcs themes nulled(t)cs-cart nulled(t)xfilesharing pro nulled(t)blesta nulled(t)arrowchat nulled(t)multi vendor ecommerce script nulled(t)seo providers(t)adsense alternative

http request – Redirect non-www to www in settings.php for Drupal 8

I want to redirect all non-www to www in below function.

if ( (!array_key_exists('HTTPS', $_SERVER)) && (PHP_SAPI !== 'cli') ) {
  if (substr($_SERVER('HTTP_HOST'), 0, 4) <> 'www.') {
    $new_url = 'www.' . $_SERVER('HTTP_HOST');
  } else {
    $new_url = $_SERVER('HTTP_HOST');
  }
  $new_url .= $_SERVER('REQUEST_URI');

  header('HTTP/1.1 301 Moved Permanently');
  header('Location: https://'. $new_url);
  exit();
}

Redirect users from admin pages the optimal solution

On two different sites I use two somewhat different solutions. Are they different in terms of security and performance? Which is better? Are there even better ones?

Solution 1.

/** Redirect users from admin pages if not administrators **/
add_action( 'admin_init', function() {
    if( ! current_user_can( 'manage_options' ) && ( ! wp_doing_ajax() ) ) {
        wp_safe_redirect( site_url() );
        exit;
    }
} );

Solution 2.

/** Redirect users from admin pages if not administrators **/
add_action( 'admin_init', function() {
    if( ! in_array( 'administrator', wp_get_current_user()->roles ) ) {
        wp_redirect( get_bloginfo( 'wpurl' ) );
        exit;
    }
} );

php – WordPress redirect from URL with BuddyPress

I am using the plugin BuddyPress on my WordPress site and when the user clicks on their profile they are redirected to the URL “/members/USERNAME/profile/home/”. However, I do not want this page to be there and so I would like the profile ‘landing’ page to be the URL “/members/USERNAME/activity/”.

I am not experienced with WordPress or PHP but I attempted to code a redirect for this when the user ends up on the ‘home’ page which is placed within my BuddyPress members/single/home.php file within my child theme:

$redirect_url_home = get_home_url();
$redirect_url_home_tt = $redirect_url_home;
$username_redirect_tt = wp_get_current_user();
$new_redirect_slug = "'/members/'.$username_redirect_tt->user_login.'/activity/'";
$redirect_url_home_tt. = $new_redirect_slug;
echo($redirect_url_home_tt);
wp_safe_redirect( $redirect_url_home_tt );

This code doesn’t work but that was my thinking of how to solve my problem and I’m sure there is an easier/nicer way to do what I would like, maybe even without a coded redirect and within BuddyPress itself? I have tried using their forum/documentation for answers but haven’t had a reply or found anything useful.

As I say I have no experience with this sort of stuff so any help would be greatly appreciated! Also, to add, I cannot link the site as it is currently on a localhost.

Thanks!

interface – Which ergonomic criteria would justify the behavior of redirecting the user to a 404 redirect page?

Without having to reference the criteria (because I think it is not necessary to answer the question), you are probably struggle with the question because of a couple of reasons.

Firstly, it is possible for there to be more than one way of classifying something, and if the criteria doesn’t allow for this (or isn’t flexible enough to adapt) then you should consider customizing it so as to be more fit for your purpose.

Guidance and error management can both fall under the bigger perspective of messaging and notification to the user, which allows the user to feel in control of their actions (in their interaction with the system). So I don’t see this as a problem that you can’t fit it neatly into just one category.

The other thing is that there are ways to implement a 404 page that leads to a more positive user experience, and ways that can make the user more confused and frustrated. So it is not so much redirecting the user to a 404 page that is the problem, because at some point your system will probably generate an error that you can’t necessarily address immediately (e.g. the server is down).

But as with all good error handling and management best practices, if you can:

  • identify the source of the error (i.e. is it caused by the user or
    the system)
  • provide some idea the nature of the error (e.g. is it an expected error caused by things like validation or something unexpected and outside of the system) and then
  • give some ideas of how to resolve the issue or perhaps next steps

Then your users will thank you instead of clogging up your support system/mechanisms.