Developer forum

Forum » Development » Redirect URLs that contain multiple forward slashes and/or uppercase letters

Redirect URLs that contain multiple forward slashes and/or uppercase letters

Roald Haahr
Reply

Hi,

Is there an easy way to avoid multiple forward slashes in DW 9 URLs? For example http://example.com//test and http://example.com//////////test should both redirect to http://example.com/test for SEO purposes to avoid duplicate content. And while we are at it, is there an easy way to redirect patterns like http://example.com/TeSt to http://example.com//test?

I read somewhere that it is best to handle these case in the global.asax file. However, DW 9 does not allow that option, so rewrite in web.config the way to go, or is there a magic checkbox somewhere in the backend that will take care of it?

Best regards,
Roald, Novicell


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Wow, SEO experts always find a way to cheat customers out of money they do not need to spend... This one was new smiley. Not even Google handles that: https://developers.google.com////search/docs/beginner/seo-starter-guide or Amazon: https://www.amazon.de///-/en/b?node=1624983031&ref=unrec_bubbler_2_en&pf_rd_r=5XPW3GC09C8QK46A348F&pf_rd_p=7e0d039c-ea18-4c52-9542-03fbc8b0c888&pd_rd_r=9a4c282b-014e-4bd4-a8f8-b1cfa323f61f&pd_rd_w=YacdU&pd_rd_wg=bY5Ev&ref_=pd_gw_unk - I like their SEO urls by the way!

  1. You can do whatever you want in Global.asax and make your own - just remember to call our versions of each of the methods. NOT recommended though.
  2. You can maybe do this in web.config. Be careful - you can easily break something.
  3. You can use a notification subscriber from the application stack: https://doc.dynamicweb.com/api/html/d5ca8c8b-6af4-5bf1-8086-81de1f7037a3.htm

I would recommend 3.

Dynamicweb should redirect to lowercase automatically: https://www.dynamicweb.com/proDucTs - that redirect comes from the "Ensure unique path" checkbox, see dump.

So what would you do about things like example.com/?doesnotexist=JustSomethingMadeUp

Anyways - happy coding!

Capture.JPG
Votes for this answer: 1
 
Roald Haahr
Reply

My exact thoughts :) Thanks for the recommendation

 

 
Nicolai Pedersen
Reply

When you look into this, you might discover that you cannot do this by code. IIS seems to remove the // on the way in, so you cannot detect this (which also explains why it even works with //).

So maybe a redirect rule in web.config in system.webserver section will be able to fix it - if the // has not been removed already.

 

You must be logged in to post in the forum