index.php?route=product/catalog to index.php
I tried to redirect from cpanel and it redirects to ?route=product/catalog
301 > permanent redirect
302 > temporary redirect
function redirect($url, $statusCode = 302) {
header('Location: ' . $url, true, $statusCode);
die();
}
function areUrlsTheSame($url1, $url2)
{
$mustMatch = array_flip(['host', 'port', 'path']);
$defaults = ['path' => '/']; // if not present, assume these (consistency)
$url1 = array_intersect_key(parse_url($url1), $mustMatch);
$url2 = array_intersect_key(parse_url($url2), $mustMatch);
return $url1 === $url2;
}
TO match the current URL with the URL that you want to redirect then use the areUrlsTheSame function. if they match then call the
Redirect('https://yourwebsite.com/index/', false);
Thanks & Regards
Sehaj Kaur
TMD Extensions
Contact Us For Customisations
Code: Select all
RewriteCond %{QUERY_STRING} ^route=product/catalog$ [NC]
RewriteRule .* https://YOURDOMAIN/index.php [R=301,L]
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
If I browse index.php?route=product/catalog it redirects to https://example.com/?route=product/catalog and if I browse this is doesn't redirect at all.by mona wrote: ↑Mon Mar 27, 2023 10:17 pmno idea as to why you would want to but:Code: Select all
RewriteCond %{QUERY_STRING} ^route=product/catalog$ [NC] RewriteRule .* https://YOURDOMAIN/index.php [R=301,L]
Code: Select all
RewriteCond %{QUERY_STRING} ^route=product/catalog$ [NC]
RewriteRule .* https://YOURDOMAIN/index.php [QSD,R=301,L]
I can recommend this one
https://www.opencart.com/index.php?rout ... on_id=5388
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Works now. Thanks a lot!by mona wrote: ↑Wed Mar 29, 2023 4:47 amTryYou will probably have more luck with an extension.Code: Select all
RewriteCond %{QUERY_STRING} ^route=product/catalog$ [NC] RewriteRule .* https://YOURDOMAIN/index.php [QSD,R=301,L]
I can recommend this one
https://www.opencart.com/index.php?rout ... on_id=5388
How about redirecting all www links to non www. Can you help with this? Thanks!by mona wrote: ↑Wed Mar 29, 2023 4:47 amTryYou will probably have more luck with an extension.Code: Select all
RewriteCond %{QUERY_STRING} ^route=product/catalog$ [NC] RewriteRule .* https://YOURDOMAIN/index.php [QSD,R=301,L]
I can recommend this one
https://www.opencart.com/index.php?rout ... on_id=5388
Code: Select all
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Works great. What do you think it would be better to use, www or non www?by mona wrote: ↑Mon Apr 10, 2023 5:39 amtryCode: Select all
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC] RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
I should have mentioned if you want to hardcode your url for security
Code: Select all
RewriteRule ^(.*)$ https://YOURDOMAIN/$1 [L,R=301]
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Got it. Thanks for the help!by mona wrote: ↑Mon Apr 10, 2023 10:43 pmI do complete design work, often I use without, sometimes I use www.xxx.com rather than writing web (or similar) on a business card, sometimes the logo contains www.xxx.com, so that is what the site will be. All just depends on the whole concept and what / who is doing the other things that are going on and just keeping it constant.
I should have mentioned if you want to hardcode your url for securityCode: Select all
RewriteRule ^(.*)$ https://YOURDOMAIN/$1 [L,R=301]
Users browsing this forum: No registered users and 520 guests