Post by Joe1234 » Fri Jan 17, 2025 2:01 am

Odd issue. I setup the following redirect. Notice the one that points to google. After that particular redirect, if I go and put my site in the url it automatically sends me back to google. No matter how many refreshes, the same thing happens until I delete the browser data. Am I using this incorrectly because I only see that redirect with "$this->url->link"?

Code: Select all

	switch ($redirect_selection) {
		case '429 Error':
			http_response_code(429);
			exit;
		case 'Home Page':
			$this->response->redirect("http://google.com");
			//$this->response->redirect(HTTPS_SERVER);
			exit;
		case 'Custom':
			$this->response->redirect($this->config->get('custom'));
			exit;
		case 'Reload':
			// refresh current page	
			exit;
		}
tested with default OC same issue.
Last edited by Joe1234 on Sat Jan 18, 2025 2:15 pm, edited 1 time in total.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by softmonke » Fri Jan 17, 2025 4:34 am

Chrome caches 301/302 redirects - which is probably why (as you mentioned) the redirects keep persisting until you clear your browser cache.

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am


Post by Erika383Rivera » Fri Jan 17, 2025 2:21 pm

Hello!
Thanks for the solution, It worked just fine for me as well!


Posts

Joined
Fri Jan 17, 2025 2:17 pm

Post by nonnedelectari » Fri Jan 17, 2025 5:52 pm

Joe1234 wrote:
Fri Jan 17, 2025 2:01 am
Odd issue. I setup the following redirect. Notice the one that points to google. After that particular redirect, if I go and put my site in the url it automatically sends me back to google. No matter how many refreshes, the same thing happens until I delete the browser data. Am I using this incorrectly because I only see that redirect with "$this->url->link"?

Code: Select all

	switch ($redirect_selection) {
		case '429 Error':
			http_response_code(429);
			exit;
		case 'Home Page':
			$this->response->redirect("http://google.com");
			//$this->response->redirect(HTTPS_SERVER);
			exit;
		case 'Custom':
			$this->response->redirect($this->config->get('custom'));
			exit;
		case 'Reload':
			// refresh current page	
			exit;
		}
tested with default OC same issue.
just use:

Code: Select all

$this->response->redirect("http://google.com",'307');

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by paulfeakins » Fri Jan 17, 2025 8:08 pm

Erika383Rivera wrote:
Fri Jan 17, 2025 2:21 pm
Hello!
Thanks for the solution, It worked just fine for me as well!
Lol, you're a bot, you're banned, goodbye.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by softmonke » Sat Jan 18, 2025 5:58 am

paulfeakins wrote:
Fri Jan 17, 2025 8:08 pm
Erika383Rivera wrote:
Fri Jan 17, 2025 2:21 pm
Hello!
Thanks for the solution, It worked just fine for me as well!
Lol, you're a bot, you're banned, goodbye.
Off-topic but genuinely curious what's the purpose of bots making such posts? What do they even achieve man.

Check out our ever-growing list of extensions for OpenCart here.
Some useful extensions for a better admin experience: Image File Manager ProDrag & Drop Sort Order

Reach out to us at hello@softmonke.com for your OpenCart web development needs or feedback for our extensions.


User avatar
Active Member

Posts

Joined
Tue May 23, 2023 4:42 am


Post by Joe1234 » Sat Jan 18, 2025 2:15 pm

Thanks. That didn't work for me. I had ended up needing to add

Code: Select all

header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
before the switch section. Seems to have solved the problem.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by nonnedelectari » Sat Jan 18, 2025 2:56 pm

Joe1234 wrote:
Sat Jan 18, 2025 2:15 pm
Thanks. That didn't work for me. I had ended up needing to add

Code: Select all

header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
before the switch section. Seems to have solved the problem.
no-store is enough as it supersedes all the others.
must-revalidate is only considered when the cache expires.

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm
Who is online

Users browsing this forum: Google [Bot] and 46 guests