Redirecting with Namecheap removes the path and sends all URLs to the home page
https://www.namecheap.com/support/knowledgebase/article.aspx/385/2237/how-do-i-set-up-a-url-redirect-for-a-domain documents NameCheaps redirecting rules:
It is important to note that the value in the Destination URL affects where and how the URL is redirected.
Host:
www1.example.net
Destination:http://example.com
Host:
www2.example.net
Destination:http://example.com/
In the first case,
www1.example.net
will not pass values to the destination URL, sowww1.example.com/xyz.html
will redirect users tohttp://example.com
only. Thus, all values that you put in the original URL under your domain name will be left out.In the second case,
www2.example.net/xyz.html
will redirect users tohttp://example.com/xyz.html
(pay attention to the symbol "/" in the configuration). All values that are put into the original URL under the domain name will be included in the destination address and applied in the results.
You have to add the trailing slash on the destination URL to get NameCheap to preserve URL paths.
Related videos on Youtube
Stephen Ostermiller
Updated on September 18, 2022Comments
-
Stephen Ostermiller over 1 year
I'm having trouble redirecting www to non-www links using Namecheap. I added a URL Redirect Record with a host of www and a value of
http://example.com
which works fine for the main (and mostly only page).The problem is that I'm setting up SSL using Let's Encrypt and it needs to verify using the file served at
www.example.com/.well-known/acme-challenge/whatever
. But the way the redirect rule currently works is that I have it redirects every URL tohttp://example.com
(the homepage) instead of just removing www from the current URL. This obviously breaks the Let's Encrypt setup since it can't verify that page using www since it redirects to the homepage instead.If it matters I'm hosting this site on GitLab Pages so my other rule is an
A
Record with host@
and value52.167.214.135
. But seeing as my non-www URLs work fine I don't think this rule is causing an issue. Any ideas? -
Leon over 5 yearsThanks Stephen, this trick works for me. But there is still a issue, it seems namecheap URL redirect only will work with HTTP. Access
https://example.com
orhttps://example.com/xyz.html
will just be hanged there.