8 – Redirection to an external URL

I'm trying to redirect to an external URL in a custom controller.

This is my code:

public function test() {
  return new TrustedRedirectResponse('https://google.com', 307);

For all I know TrustedRedirectResponse can be used to redirect to external URLs, but it continues to redirect to the home page.

The problem could be my .htaccess configuration?

Magento 2: Old product URL to the new product URL, redirection

  1. Create some new products. And set a URL for that (test1, test2, test3, etc.)
  2. Change the URL via the CSV import of this product (SKU, url_key) .. (go to 10test, 11test, 12test, etc.)
    . When you use the old URL in the front-end, it must be redirected to the new URL.
    Help? Thank you in advance.

htaccess – Redirection with URL path redirection

I want to redirect a subdomain to a domain with URL path redirection.




The end URL must be preserved.

We have created more than 1000 subdomains and some of them must be redirected to domains. Subdomains are created virtually.

I use Linux web server and PHP as language.

I believe this can be done by changing the IP address of domain2.com to domain1.com and adding codes to the .htaccess file.

redirection – Multisite htaccess redirection does not work

I have a multi-site installation of Drupal 8 with a .htaccess file in the config directory. I also have a .htaccess file at the root. (I think this is the default, but if there is no .htaccess file in the config directory, there is an error on the status page. )

I would like to do a redirection so that the URLs containing / – / are redirected to a URL without it.

Until now I have tried with the following.

  RewriteEngine on
  RewriteCond %{REQUEST_URI} ^/-/(.*)? (NC)
  RewriteRule ^(.*)$ %1

I have tested it with https://htaccess.madewithlove.be/ and it looks to go, but it does not do the redirection.

Could someone point me in the right direction?

to use the redirection for the page specifies after validation in case of error – Laravel

Well I have the code below


class FormNew extends FormRequest{

public function authorize()
    return true;

public function rules()

    return (
        'email' => 'required|email',

public function messages()

   return (
        'email.required'        => 'campo Email Obrigatório',
        'email.email'           => 'campo Email com formato inválido',



FormController class extends Controller {

public function newsletter(FormNew $request)

    $usuarioEmail = Usuario::Where('email', $request->email)->first();

    if($usuarioEmail == null){
        $usuario = new Usuario;
        $usuario->perfil_id         = '2';
        $usuario->email             = $request->email ;
        $usuario->password          = Hash::make(rand(1,100).'senha');
        return redirect('?#newsletters')->with('SucessoCadastro', 'Email Cadastrado com sucesso!');
        return redirect('?#newsletters')->with('Falha', 'Email já cadastrado no sistema');



look in my redirection, I'm using an anchor. So, when the user sends the form, he goes directly to the place where the form is located, I wanted to know how to use this redirect in my validation, because, when he gives the ; error, it displays the form. (FormNew).

Redirection – Nothing happens ??

I have a WordPress blog on my site. The newly created whole site runs on WP that replaces an old obsolete site. I do not know if I did it right, but now I have two WordPress installations.
That's fine, but I want to permanently redirect some posts to new pages on the main site.
mysite.com/blog/post redirect at mysite.com/newpage

I've tried using cpanel and nothing is happening. I've tried using a WP plugin and nothing is happening.
Ideas. I think my messages cannibalize my SEO …

Redirection – Nothing happens ??

seo – Move a site from one subdomain of another domain when we will not be able to get redirection


I would appreciate it if you could help me with a situation that I have right now with the company in which I work.

We are an online journal specializing in technology articles. Our own writers write about different topics related to technology.

The problem, however, is that our founders thought it would be a good idea to sign a contract with a traditional newspaper to give us a boost in terms of traffic. The terms of the contract are basically that our website is under their domain (mynewspaper.bigtraditionalnewspaper.example) and in return, we have links in their web page through some widgets located in different sections. In addition, we host our own website and the content belongs to us. Now, this big old traditional newspaper is many times associated with the very distant political ideology of my country.

And now that the contract is about to end and we will have to ask them whether or not to continue the contract, we have the following question:

In terms of positioning and indexing, if we do not renew the contract and the big old traditional newspaper refuses our friendly request to redirect the current URLs to a new area of ​​our own (mynewspaper.example), since they are the owners of the current subdomain for which we are currently indexing … Is there a way to remedy this situation? We are concerned that our articles will be indexed both with the old URLs and with the news and the old leading to a 404 error because the other journal did not want to collaborate. The ideal would be to redirect them to the new domain and manage permanent redirects so that Google understands that we have gone from domain.

How are you going to handle this?

htaccess – Prevents canonical redirection for the (pre-production) transfer domain only

We have one wordpress instance accessible in two different domains: https://example.com/wp/ and https://staging.example.com/wp/.

The first is the canonical site, but the second should also be accessible. The problem is that wordpress automatically performs a 301 redirect to the canonical site.

This redirection is correct in most cases. So I do not want to disable it entirely, but just prevent it on this specific domain and, if possible, without touching too much code.

Is it possible to use the .htaccess file to modify the query by making wordpress the way to the canonical side (thus preventing redirection)? In addition, it could allow me to add the header X-Robots-Tag: none to prevent the indexing of duplicate content.

I think this approach can have minimal impact, but is there a better alternative?

authentication – Does the disclosure of PHP redirection information also apply to other languages ​​or frameworks?

When redirecting using header("Location MyPage.php"); in PHP, any code present after will be executed. Thus, if you use this to prevent users from accessing the pages to which they must be connected, the content of the page will always be processed and sent to the client. Using a proxy, you can set that despite returning an error code 302, you will also get the contents of the page.

My question is: in which other language or framework is this problem

routing – wireless redirection to the router connection with the domain name from the local network

I have a modem / router Smart / RG for access to the WAN and a second Netgear router behind the wired LAN. I'm hosting a website on a computer connected (wired) to the Netgear network.

All computers connected via Ethernet to Netgear can connect to the site by domain name because I have configured the hosts files on each of them.

However, computers connected to the Smart Grid on the Smart / RG or Netgear can not connect to www.mysite.com, but can log in to subdomain.mysite.com. When they go to www.mysite.com, they are redirected to the Smart / RG login page. If they go on mysite.com (without the www), it works fine. I can not understand why this is happening.

My ISP has not provided a manual for the Smart / RG modem and their website does not allow you to download it. The router configuration has no built-in help.