Web config redirects not working where a trailing slash is involved
-
I'm having real trouble with getting working redirects in place to use on a site we're re-launching with a modified url structure.
Old URL: http://www.example.com/example_folder/
New URL: http://www.example.com/example-of-new-folder/
Now, where the old URL's have a trailing slash the web.config simply will not accept it. It says the URL can start with a slash, but not end with a slash. However, many of my URL's do end with a slash so I need a workaround.
These are the rules I'm putting in place:
<location path="example_folder/"></location>
Thanks
-
That works perfectly, thank you very much
-
The following will work for both slash and no slash,
<rule name="Test" stopprocessing="true"><match url="^example_folder"><action type="Redirect" url="/newfolder"></action></match></rule>
if not sure where to place it, see link in last post, bottom of page
-
Thanks for the response Alan.
However, the problem is with the old URL's, so where they have a trailing slash I cannot get them to redirect to any URL's of the new structure (with a trailing slash or otherwise.).
To simplify the ask, how do I put in place a 301 redirect from 'http://www.example.com/example_folder/' to some other URL?
-
i would first decide if you want a slash or not. i prefer not as when people type urls they rarly add a slash on the end.
see this page will tell you how to remove all slashes and then your redirects should work
http://thatsit.com.au/seo/tutorials/how-to-fix-canonical-issues-involving-the-trailing-slash
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Redirection chain and Javascript Redirect
Hi, A redirection chain is usually defined as a page redirecting to another page which itself is another redirection. URL1 ---(301/302)---> URL2 ---(301/302)---> URL3 But what about Javascript redirect? They seem to be a different beast: URL1 ---(301/302)---> URL2 ---(200 then Javascript redirect)---> URL3 From what I know if the javascript redirect is instant Google counts it as a 301 permanent redirection, but I'm still not sure about if this counts as a redirection chain. Most of the tools (such as moz) only see the first redirection. So is that scenario a redirection chain or no?
Technical SEO | | LouisPortier0 -
Redirect Chain Issue
I just found I'm having a redirect chain issue for http://ifixappliancesla.com (301 Moved Permanently). According to Moz, "Your page is redirecting to a page that is redirecting to a page that is redirecting to a page... and so on" These are the pages involved: 301 Moved Permanently
Technical SEO | | VELV
http://ifixappliancesla.com
https://ifixappliancesla.com https://www.ifixappliancesla.com/ This is what Yoast support told me: "The redirect adds the https and then the www, ending at: https://www.ifixappliancesla.com/. You want all variants of your site's domain to end up at: https://www.ifixappliancesla.com/ " - which is totally true. But I would also like not to have the redirect chain issue! Could you please give me an advise on how to properly redirect my pages so I don't have that issue anymore?0 -
My homepage redirects to itself?
Hi there - I'm not a SEO so help would be appreciated! Moz is telling me we have a redirect loop but the URLs are the same. https://www.example.com/ to https://www.example.com/ Why is my homepage creating a redirect loop to itself? We use Wordpress and I do not have any redirects listed for our homepage. Could this have something to do with switching to https in April? Thanks, Katherine
Technical SEO | | kmmartin0 -
301 redirect + new website copy
Hi There, We are currently redeveloping our website and we're rewriting and optimising our many of our service pages. I think I may already know the answer but should we apply 301 redirects from our old services pages to the new versions? The content subject matter will be the same on the new versions, they will just be completely reworded. I would be interested to hear your views. Thanks, Stu
Technical SEO | | Stuart260 -
How to know what pages are 301 redirecting to me?
Hi! It is easy to know if somebody is spam linking your website, looking i.e., looking at open site explorer to analyse the links profile. But, is it possible to know if a competitor of mine is redirecting a bad domain to main with a 301 redirect, thus transfering any bad SEO reputation to me? Best Regards, Daniel
Technical SEO | | te_c0 -
IP redirects
My website, on a .com domain, displays a different language/content depending on the IP of the user. For example, if someone is browsing my web from Spain, it will show the spanish content, and so on. Does anyone has an idea on how will Google index my pages? Their servers being located in the US, I assume the bot will only crawl and index the english content. How can I tell the bots to do the same for the other languages/content? Thanks!
Technical SEO | | Alemoto0 -
301 Redirects
Hi, I ran the seomox link report and see that I have an entry for our home page (http://www.trophycentral.com/) and http://www.trophycentral.com/index.html. The index is shown with a 301 redirect. Does this mean that a redirect is already in place to http://www.trophycentral.com/? I want to ensure our traffic is not being split between the two urls, but not sure how to confirm this. Thanks! <colgroup><col width="294"></colgroup><colgroup><col width="81"></colgroup><colgroup><col width="80"></colgroup><colgroup><col width="77"></colgroup><colgroup><col width="214"></colgroup>
Technical SEO | | trophycentraltrophiesandawards
| URL | HTTP Status | Total Links | Page Authority | Number of Linking Root Domains |
| http://www.trophycentral.com/ | 200 | 5746 | 53 | 244 |
| http://www.trophycentral.com/index.html | 301 | 5123 | 42 | 4 |1 -
301 redirects inside sitemaps
I am in the process of trying to get google to follow a large number of old links on site A to site B. Currently I have 301 redirects as well a cross domain canonical tags in place. My issue is that Google is not following the links from site A to site B since the links no longer exist in site A. I went ahead and added the old links from site A into site A's sitemap. Unfortunately Google is returning this message inside webmaster tools: When we tested a sample of URLs from your Sitemap, we found that some URLs redirect to other locations. We recommend that your Sitemap contain URLs that point to the final destination (the redirect target) instead of redirecting to another URL. However I do not understand how adding the redirected links from site B to the sitemap in site A will remove the old links. Obviously Google can see the 301 redirect and the canonical tag but this isn't defined in the sitemap as a direct correlation between site A and B. Am I missing something here?
Technical SEO | | jmsobe0