Redirect with trailing slash in netlify - netlify

i've have a gatsby site deployed on netlify. I'm trying to make a 200 redirect to a external landing page (hosted on netlify aswell) but its not seem to work out:
/abm https://some-domain.com.br/abm/:splat 301
If i make a 200 redirect, this works fine. With /abm/* works too, but if i don't add a trailing slash at the end, the landing page brokes (images, css and js). Is there a way to make something like this? where i still make a 200 and my landing page still serves assets without the trailing slash at the end.
my goal:
/abm https://some-domain.com.br/abm/ 200

Related

Why can a url have 301 redirect-loops without any .htaccess rules

I have a redirect loop on my robots.txt file which keeps redirecting from https://www.URL.com/robots.txt to the same https://www.URL.com/robots.txt. The rest of the site - or at least what I observed so far - works perfectly fine.
In .htaccess we have some redirect rules for missing https or www in place, so at first I thought the reverse proxy might for example serve a wrong protocol, but that seems not the case. After playing around for a while, I simply did a mv .htaccess .htacc to completely disable all instructions. This causes all other pages to return 404 of course (page runs on wordpress), but the redirect loop on the .robots.txt still exists. I also added a query string ?a=b to the curl request URL to ensure uncached results and tried some online tools to verify the redirect as well. All with the same result.
The robots.txt won't spin up any of the php logic and the .htaccess is disabled, so I am wondering what might still cause the 301-loop?
The server runs on docker-containers with nginx, varnish, wordpress and mariadb.

Redirecting URLs to a new subdomain with Open Cart

I have recently moved a client's e-commerce Open Cart site from theirdomain.com to shop.theirdomain.com and replaced theirdomain.com with a standard local business wordpress site.
The move went smoothly, however there are a number of pages from the original theirdomain.com that are still indexed in Google and are displaying 404 errors obviously.
I want to add 301 redirects to these pages in the htacess file to their respective subdomain pages, but when I tried the following code, the redirect worked, but the page wouldn't load properly.
Redirect 301 /carb-caps http://shop.theirdomain.com/carb-caps
It would take me to a page like this http://shop.theirdomain.com/carb-caps?route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps&route=carb-caps
I understand that this is typical of Open Cart...
The page loads fine without the redirect in place, but as soon as I add the redirect to the htaccess file, it just doesn't load.
Any ideas?
Thanks in advance!

301 redirects not working properly. Numbers in URL being ignored

I have just replaced my old non-Wordpress site with a Wordpress site. Now I need to redirect approximately 400 old URLs to their equivalent pages on the new site.
I have already recorded all the old urls and new urls, but when I put the code in the .htaccess file I am getting a strange result.
If I try to redirect to any url that has a number in it, the redirect tries to redirect to that url minus the numbers.
For example:
Redirect 301 /international_organizations/africaamerica_institute http://nyintl.net/international-organizations-in-new-york/2792/africa-america-institute/
Redirects to http://nyintl.net/international-organizations-in-new-york/africa-america-institute/
Which isn't actually a page and thus returns a 404 error.
Anyone have any idea what's going wrong? All my posts on the new site have the month/year syntax in the url, so this means that 95% of my redirects aren't working.
All the urls that don't contain numbers are redirecting perfectly.
I have made sure to put all my redirects ABOVE the WP rewrite rules, but that hasn't made a difference (tried them below as well).

magento backend url not working

I'm totally lost here, I have several Magento installations where the backend url doesn't work nice.
The problem is this:
In the frontend, all urls are perfectly rewritten so index.php is not in the url and mod_rewrite works.
but for the admin part, all urls that are created have the index.php part still in there, in a normal installation it wouldn't be a problem put now, a url like index.php/admin/dashboard results in a 404 error page. But, the funny part is that when I remove the index.php part of the url, it works.
I fixed this problem with a few .htacces tricks and hacks, but I find these hacks no good. Some parts of the backend still won't work or need their own .htacces redirect, or won't work at all even with the redirect in .htacces.
So, my questions are: Why are my Magento installations giving 404 errors on a index.php/admin call? And how to nicely get rid of the index.php part in the backend urls, without .htacces hacks?
The Magento version for all shops is 1.7.0.2
The solution is very simple, add "AcceptPathInfo On" to apache configuration.
Credits: http://www.magentocommerce.com/answers/discussion/178/index.phpinstall-was-not-found/p1

.htaccess rewrite base url for Wordpress

Ok sorry if this has been asked before but I could not find a working solution. I am using wordpress multisite. This is what I am trying to achieve.
Currently the domain http://mynew.com/ redirects (via my hosting co.) to one of the sites on my wordpress multisite installation as follows http://myold.com/subsite/
But I want to hide/swap the urls as follows, http://myold.com/subsite becomes http://mynew.com and all links that follow (eg. http://myold.com/subsite/another-link becomes http://mynew.com/another-link) without breaking.
I tried this in my .htaccess file which rewrote the url successfully however the links did not work and returned 404 errors.
RewriteRule ^subsite/(.+) http://mynew.com/$1 [R,L]
Hope that makes sense, thanks for your help.
Of course it will get you a 404 error, you redirected the request from the old site to the new site, but the new site does not contain the requested pages, so it through you a 404, what you need to do is to redirect from the new site back to the old site INTERNALY (that means without changing the browser address bar), but this requires your new site to work as a proxy server, see http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Resources