This project is read-only.

UrlRewrite and better use of Slug

Feb 7, 2014 at 7:34 PM
Hi All!

Since there are more posts than pages, a better use of UrlRewrite would be something like:

instead of:

This may seem trivial but when telling someone your URL over the phone or texting it, every saving of a character counts. And you know that one character off blows the entire URL!

I've modified my code and have been testing locally. I won't deploy until I hear from someone. So far so good. I'm putting this out there
  1. to see if someone sees any flaw in it.
  2. to convince rtur for the next version.
Feb 8, 2014 at 1:26 PM
Hi Galagerardo,

Where is your code for us to see if there is any flaw in it?

I had been very interested in this for a long time :)

I agree need to take /post part out of the url.

Just need http://blog/Post
Feb 8, 2014 at 3:38 PM
Hi kbdavis07!

What I meant was for everyone to look at the concept and not the code.

After doing a lot of local testing, I went ahead and pushed my changes to production and so far so good for such a simple web site - hardly any widgets.

Well, I'm glad you agree w me. I hope we can convince rtur.


For anyone interested in the code, I modified the UrlRewrtie.cs in the core. At the very end of all the else ifs in the Rewrite function (line 197), I added the very last else. Again, my web site is very simple so I might not have accounted for other cases.
                #region gerardo
                if (!url.Contains("/?TAG"))
                    UrlRules.RewritePost(context, "post/" + url);