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
-
Doubt with geoip redirection
Hi everyone, I managed an international site with subfolders for for the countries (us, uk, fr, ...). The homepage has a geoip redirection to the specific user country. I've checked some old posts like this ones but it's not cleared for me if I should do a 301 or a 302 redirection. https://moz.com/community/q/geoip-redirection-301-or-302 https://moz.com/community/q/geoip-and-redirects I know that the best approach it’s avoid automatic redirections but it's not a possibility for me. So please, can you help me to decide what type of redirection should I use?
Technical SEO | | dMaLasp0 -
To many 301 redirects
Hi, Is there anything wrong with over 100 301 reditects on my wordpress website and how do you go about redirecting a 301 again for example abc.com redirects to bca.com now i want to redirect bca.com to ert.com any problems with this setup? Regards
Technical SEO | | ReSEOlve0 -
How best to fix 301 redirect problems
Hi all Wondering if anyone could help out with this one. Roger Bot crawler has just performed it's weekly error crawl on my site and I appear to have 18,613 temp redirect problems!! Rather, the same 1 problem 18,613 times. My site is a magento store and the errors it is giving me is due to the wishlist feature on the site. For example, it is trying to crawl links such as index.php/wishlist/index/add/product/29416/form_key/DBDSNAJOfP2YGgfW (which would normally add the item to one's wishlist). However, because Roger isn't logged into the website it means that all these requests are being sent to the login url with the page title of Please Enable Cookies. Would the best way to fix this be to enable wishlists for guests? I would rather not do that but cannot think of another way of fixing it. Any other Magento people come across this issue? Thanks, Carl
Technical SEO | | daedriccarl0 -
301 Redirects in subfolders
Hi, we're making our site into a static site but I would like to transfer the Google juice. Most of the links and database exist on subfolders though. Could I simply do 301 redirects on the subfolders and retain the value or does it have to be on the full domain?
Technical SEO | | Therealmattyd0 -
Using Web Applications for SEO
I am in the sign/banner business, for years I have had a flash based web application that I developed which allows customers to design their own signs/banners online. With the demise of flash i am prompted to begin developing an HTML5 based application to take it's place. Developing this software is a rather expensive endeavor so many local sign shops, which don't sell on the web, don't bother to develop such an application, but what if i gave it to them? I assume a fair amount would find great value in such an application thereby allowing their clients to communicate a design idea without having to drive to the store front. The application would actually run embedded on my site thus earning me a link back to my site. Question is this: Is this a bad idea. If dozens of sign shops are running my application embedded on their sites will the help or hurt me? Thanks.
Technical SEO | | RocketBanner0 -
URL redirect question
Hi all, Just wondering whether anybody has experience of CMSs that do a double redirect and what affect that has on rankings. here's the example /page.htm is 301 redirected to /page.html which is 301 redirected to /page As Google has stated that 301 redirects pass on benefits to the new page, would a double redirect do the same? Looking forward to hearing your views.
Technical SEO | | A_Q0 -
301 redirect to new website
We are migrating to a new website that will be using entirely new URLs under the same domain as the old website. The old website is a custom PHP script and the new website uses Drupal. I know that I should use individual 301 redirects to the corresponding new pages. My question is just how to set up the hundreds of 301 redirects from the old website to the new one? Here is the process I've come up with. Please let me know if there is an easier and better way for this. Before actually changing to the new website: download an advanced report with all pages on this domain from OSE. Find corresponding pages on the new website Make the hundreds of 301 redirect lines in an .htaccess file with the following code: redirect 301 /oldurl.html http://domain.com/the-full-url Thanks in advance for your help!
Technical SEO | | qbeeker0 -
Redirecting Domains
Hi Everybody, My clients owns a lot of domains related to his website. I redirected them to the website. So his website is: www.vallnord.com but if you type Vallnordski, vallnordsnow, etc etc they will go to the website, but they will not change the url and will keep vallnordski, vallnordsnow instead of going to vallnord.com Not very clear actually, so if you have 20 seconds to type them you will see it very clear. I was wondering if this was a good practice or it is better to actually redirect someone completely (If they type vallnordski.com take them to vallnord.com)? Is redirecting a good SEO practice? Regards, Guido.
Technical SEO | | SilbertAd0