How to take out the /page in the URL for BE 2.6?

Topics: Business Logic Layer, Controls
Sep 22, 2012 at 5:37 PM


Still facing the same issue as with BE 2.5 which I never had solved yet.

Has any one figured out how to remove the /page or /post from the URLS in BE 2.6?

I notice it has the option to take out the extension .aspx from the pages and posts.

Hoping soon for an option to take out the /page and /post in the URL's.


Goal is this:




to be



In the mean time has any one figured out how to do this?


Or Which files would need to be changed in order to make this possible?




Brian Davis




Sep 24, 2012 at 12:55 PM

Hi Brian,

from what I've seen from the code, the /page and /post URL segments are hardcoded. You can only get rid of them by diving into the code. If you feel comfortable doing that, you can start looking in UrlRules (BlogEngine.Core\Web) and UrlRewrite (BlogEngine.Core\Web\HttpModules).


Nikolaos Georgiou

Jan 20, 2013 at 9:46 PM
Edited Jan 20, 2013 at 10:47 PM

For BE 2.7:

It is quite easy to remove one of these from the url... but a little harder to do both.  There are only a couple of files that need to be modified.  (Can only be done with the source code)

Lets just do the posts first:

You can comment out this line (as we should not have /post/ in the url soon)... This is in the blogengine\blogengine.core\web\HttpModules\UrlRewrite.cs file

at the end of this file, you will need to add an else statement... basically a catch everything else which will be the post rewrite.

Finally, we just need to take /post/ out of the relative link method in the post class.


The same principle applies to the pages, but as the else statement (2nd pic above) is picking up the post, you will have to change this to the page rewrite.

If you want both the page and post removed from the url, you will need to do some cleverness in the else statement (pic 2) above (I've not attempted this yet).  You will need to test if the post rewrite works and if not have a go at the page rewrite (or vice versa)... remember if you have a post and a page with the same name, only one is going to be delivered.

Once you have it working fine, just publish the website to a folder using visual studio and you're done.

Jan 20, 2013 at 10:06 PM

Just to clarify, this works on a clean install and was done in a subfolder /blog/ ...

If you already have posts and you make these changes, the links for these posts/pages will no longer work as they will need /post/ or /page/ removing from the url in the database / xml etc...

Mar 29, 2013 at 9:29 PM
@duckodil: I cant find the last line of code in your 3rd image in UrlRewrite.cs
Mar 29, 2013 at 9:30 PM
Edited Mar 29, 2013 at 9:31 PM
nevermind, i saw you mentioned post class and looked at the post.cs and found the line.