soultricks.com

BlogEngine.net: how to move a website from subdirectory to root

Who I am
Martí Micolau
@martímicolau
EXTERNAL REFERENCES:

SOURCES CONSULTED:

Article rating:

Content warning

Before proceeding with the explanation it is good to do a backup of all your data so that no data is lost.

If you need to move your entire website into BlogEngine.net from a subdirectory to the root of your own site, all you have to do is remove all the content from the subdirectory with FileZilla Client and move it to the main root.

Then open the file Global.asax, located in the site root, and replace the lines of code below:



void Application_BeginRequest(object source, EventArgs e) { HttpApplication app = (HttpApplication)source; HttpContext context = app.Context; // Attempt to perform first request initialization FirstRequestInitialization.Initialize(context); }

with the following:

void Application_BeginRequest(object source, EventArgs e) { HttpApplication app = (HttpApplication)source; string thisUrl = app.Request.Url.ToString().ToLower(); if (thisUrl.Contains("https://www.SoulTricks.com/blogengine")) { HttpContext.Current.Response.Status = "301 Moved Permanently"; HttpContext.Current.Response.StatusCode = 301; HttpContext.Current.Response.AddHeader("Location",thisUrl.Replace("https://www.SoulTricks.com/blogengine","https://www.SoulTricks.com")); CompleteRequest(); } HttpContext context = app.Context; // Attempt to perform first request initialization FirstRequestInitialization.Initialize(context); }

This is the best way for users and search engines to be directed to the correct page. In this way, those who type the old URL https://www.SoulTricks.com/blogengine in the address bar will automatically be directed to the new URL https://www.SoulTricks.com.

Code 301 indicates that the page has been permanently moved to a new location.

I 301 redirects they are useful when:

  • you moved the site to a new domain;
  • users access your site through different URLs, for example: http://example.com/home, http://home.example.com or http://www.example.com. With the 301 redirect you define the preferred URL;
  • you want to merge two websites and you want to make sure that the links to the previous URLs are redirected to the correct pages.
Alejandro Crespo Martinez We are a specialized and passionate team of virtual reality. We have extensive experience in this area. We decided to create ForVirtualRealityLovers to share all our information with customers and users. We have quality information. You can find tips, guides, interviews, top products and much more! If you are curious, enter our site ForVirtualRealityLovers.com and discover the virtual world! 😉 BlogEngine.net: Disqus comment count generates an error that's why ❯

Articles related to

Best alternatives to Stockists to buy smartphones and tablets
Prime Day 2020: best audio, photography and smart TV offers
How to make and save screenshots of Internet sites
How to buy on Amazon without being scammed
OnePlus X, Meizu Metal e Meizu Pro 5 in preordine su Gearbest
Online shopping, food and drinks now arrive directly at home: here are the numbers of an announced success
Add a comment from BlogEngine.net: how to move a website from subdirectories to root
Comment sent successfully! We will review it in the next few hours.

Internet

  • How to delete Facebook account permanently
  • Mobilegeddon: the new Google algorithm for mobile devices
  • Where to find the Google Analytics tracking code
  • Facebook and Privacy
  • 4 effective ways to make money on Pinterest
  • The new services introduced for maps by Google
  • After WhatsApp and Instagram Facebook acquires Oculus
  • OnePlus 2 purchasable without invitation on GearBest
  • Let's create our first eBook
  • 5KPlayer the multimedia player to download Youtube videos and play 4K ultra HD videos
  • How to configure PEC on Gmail
  • The best free video chat services
  • Sites to download games, movies, music and programs with JDownloader
  • How to exchange items on the web with online barter without spending
  • Where to find coupons and discount codes to save
  • What to do when the wi-fi connection on notebook is not working?
  • What does Landing Page mean?
  • How to play chess on Facebook with smartphone or PC
  • How SPID - Public Digital Identity System works
  • Amazon Gaming Week 2022: the best offers
❤️Chi Sleep For Virtual Reality Lovers?

For Virtual Reality Lovers we are a team of people who aim to give you all the best information about Virtual Reality.


What information do we share?

We share everything you need to know about virtual reality, tips, prices, features, guides and much more !.


🤖What are the best virtual reality products?

We have the best information section on the best virtual reality products.


This work is under a Creative Commons Attribution-Non-Commercial-No Derivatives 4.0 International License. 2021/primerpaso.me X

Check out our best articles!

How to find out who visits your Facebook profile

How to insert a donation button in Blogengine.net

Track Twitter clicks with Feedburner

How to archive Outlook messages

Add a comment from BlogEngine.net: how to move a website from subdirectory to root
Comment sent successfully! We will review it in the next few hours.