Setting up a redirect using Apache is quite simple, but getting it to work with dynamic URLs can be a lot more difficult. Lets say you want to redirect all traffic from one file to another file in a different location/server. How do you perform this redirect while keeping all of the url variables intact? I have seen some many answers from people that suggest you use a mod rewrite matching method that has all sorts of complicated matching parameters that make it almost impossible to convert that answer into a solution that works for you. This solution is far more simple and will work for most instances without needing to be heavily modified.

In order to setup this redirect you will need to add some code to the .htaccess file of your website. This file can usually be found in the root directory of your website. It is more efficient to use your htaccess file when compared to using PHP. When you use PHP, Apache will need to call it and then PHP does the work. It might be easier to work with PHP, but doing the job with Apache cuts out the work the server has to do. The following piece of code will perform a simple redirect from a file in one server to a file on a different server/subdomain.

It’s as simple as that. By putting the $1 at the end, it is telling apache to match a url that starts “script1.php” and treat everything after this as a variable, when performing the redirect, put all of this content at the end of the new URL. If your files are inside a sub folder you can easily add this onto the first part of the redirect match.

This is a much cleaner and simple method of performing a redirect for a single file while keeping all of the URL variables in place.

Sometimes you get hit with a load capacity issue that you may have not expected. For example, you have created a site with multiple scripts and these scripts are now being accessed so much that the one server isn’t able to cope with all of the traffic. Rather than spending a fortune setting up fancy hadoop cluster, you can simply setup subdomains. For example if you moved to you could better balance the load across multiple servers and use DNS records to change where it is pointing. Setting the subdomains up is simple, but the problem is how do you setup a redirect on the old server that will push all traffic to the new url? You could use PHP, but why not let Apache do the job instead of bringing PHP into the mix.

Using the .htaccess file in the root directory of your website you can make Apache redirect

If you are using a script that required some extra variables you can instead use the RedirectMatch method instead. This will allow you to perform the same redirect above where you will redirect a file from one location and send it to a file in a different location. The only difference here is that any url variables will be passed along with the redirect. For example, if your original URL contained something like script1.php?foo=123&bar=123454. All of the information after the ? would also be passed along to the new script.


command line

By default, most instillation of Centos will end up having the default protocol set to be dynamic (DHCP) for obtaining the IP address. For a web server this is not what we want as it will be no good having the IP change and then having to change DHCP records to correctly point to the new IP address. This tutorial will show you how to change the IP protocol for a Centos 7 OS to use a static IP instead of a dynamic IP.

Start by navigating to the directory that contains the IP config files.

You should get a list of files that are inside this directory. Most of the time there will be a file named “ifcfg-eth0”, but its not always the case. The name may vary, but it will always begin with “ifcfg”. When you are looking at the results have a look and see what files are in this directory that begin with “ifcfg” and work from there.

Once you have found the correct file you will see that there is a variable near the top of the file called “BOOTPROTO”. This will be set to “dhcp” this needs to be changed to be static. You will then need to go to the bottom of the file and alter or add some values for the network information. Your file should look like the file below once you have finished. (be sure to replace the placeholder info with actual IP information).

If you are in a situation where you have no access to the machine other than command line, you will need to use VI to edit the file. Once you have a static IP you should be able to connect to the machine using SFTP and modify the file using a text editor.

Once you have made edits to the file, you will need to restart the networking on the server. The following command will restart the networking and should now allow you to access the server using the static IP that you have defined.


There are many different ways to get the IP of the current server on linux machines which causes a lot of conflict across the different variations. Not all operating systems use the same command and sometimes the command used is not built in as part of the operating system. If you are running the minimal install of Centos 7 you will find that the standard command “ifconfig” does not exist. You could install this if you wish, but there are methods to obtain this using the tools you have available already. There are 2 possible ways to get the IP address.

This will dump out quite a bit of info, the import part being the IP address of the server. This can be a bit messy, but is a more reliable method of obtaining the servers IP. If you want a quick an easy way of finding out what it is, you can run the following command to display just the IP. This is not as reliable and will sometimes return a blank value for a server that has not been configured correctly.


Most people start blogging and get excited about the fact that you can actually make real money just from putting a few ads on your blog. This then leads to the main reason that ad-blocker and other ad blocking software has become so popular. When people to choose to monetize their blogs they seem to think that more ads means more money. This is true, but it is not now you monetize your blog efficiently and is exactly how you can trigger the downfall of your website. People do not want to visit your site and have to dig through layers of adverts in order to find the content they came for. Yes you may get a nice amount of money per visit, but over time the visits will slowly decrease until your site gets no visitors. Knowing how to effectively monetize a site with ads will save you a lot of heartache and is not as difficult as it seems. Sites like have become the most horrible websites on the web, you don’t want to become another site like this.

The first rule when running a site is never assume that your site is so good that people are going to flock from far and wide to view it. Unless you have a really particular talent or skill that is not something many people can do, chances are the content you post on your website can be found in several other places. In order to make your site work well, is to build a better user experience. If a user comes to your site and is plagued ad every corner with ads, the user will not enjoy their experience, and will likely avoid engaging with your site any further. A click from a search engine is like a fish biting a worm, you don’t want the fish to grab the worm and leave without biting the hook. You need to make the presentation as appealing as possible. If your site is better than other sites, you will get more traffic. More traffic means more ad impressions and more money for you. As always, never take advantage of the traffic by adding more ads. Make it look natural and never shove ads in visitors faces. More visitors will come if your site is good and this is how you get more ad impressions. Never sell out! Perseverance is the only way to make a successful website.

With everything that I have said above you are likely asking yourself, how many ads is too many and where should i place them. This is a very subjective question and there is no general answer that will cover all website, but here are a few things you should know to reduce the chance of making any mistakes.

Don’t bunch ads together

There is no point putting several ads all in the same location. Cluttered adverts look ugly, and usually cause the user not to look at this area of the page because they know its all ugly spam.

Don’t slow down page load speed

Adsense may be one of the most popular ad networks, but it is also one of the slowest. From experience i have seen each adsense advert add up to 1 second to the page load. Even when you use async ads, the page still is not considered loaded and it can make the users browser run very slow if they are not using a powerful device. Every ad you add to a page means more processing and more delay it takes to load the page.

Blend ads in with content 

Putting ads in obvious locations with big flashy banners is exactly what most people have trained their eyes to ignore. You need to merge your ads in with the content. Never put more than 1 ad in the body of an article. Putting it near the upper 3rd of an article is usually the best place to put your ads.

Consider Mobile

Sidebars are a popular and often effective location to place adverts, but these do not work for mobile sites. If you have a responsive site, chances are the sidebar gets moved to the very bottom of the page when viewed on mobile. If you have all your ads here or a large number of them on the sidebar, it will slow down the page and a large amount of visitors will never go down to this part of the page and never see these ads.

Users don’t need to see an ad on every page

When placing ads people often set it up in a way so that a user will see an advert on screen no matter what part of the website they are currently looking at. There is no need for this. A user is here to view your website, this is more valuable than the couple of cents you get from a user clicking the ad. Don’t make a user leave your site for a couple of cents. It can also make users dislike your site. They don’t want to feel like they are subject to a plague of adverts. Subtle advertising works far better than in your face. If a user visits one page and sees the same add 10 times all they will remember is that the website sucks. If they visit 10 pages and see the same add once, they will subconsciously remember the ad. This doesn’t benefit you, but it does benefit your long term income since you can guarantee effective advertising.

Don’t use popups for ads

If you want to use a popup for your newsletter then go ahead, but use a cookie to make sure it doesn’t keep popping up every time the user visits the site. Making ads pop up or even pop under are horrible intrusions to the user experience. They make you quick money and also make your site look bad. If you are running a viral site that has a 100% bounce rate then do what you wish, but if you want to run a proper website, don’t do this. It makes your site cheap and will push users away.

Search Engine SEO

Anyone who has ever run a blog will have encountered at least 1 of the 2 common guest blogging scenarios for boosting SEO. The most common scenario is when a site owner gets contacted by someone claiming to work for a marketing agency. They “love” your blog and would like to post an article on it, sometimes they may even offer to pay you money to do it. This is enough to get any small site owner excited, its almost like a triple win. Someone likes your blog, they want to give you easy money and you get extra content for your blog without doing any work. Like anything else in live, if it sounds too good to be true, it probably is. The question you need to ask yourself is “what do they get out of this?”. The answer is quite simple, but isn’t something a lot of people know if they aren’t fully familiar with how SEO and Google works.

One of the many different ways that Google considers the value of a website is to check how many websites link to your website. Think of it in the real world. If the CEO of Microsoft says that your tech blog is the best site ever it will really hold a lot of weight, now if a junkie down an alley says the same, his opinion isn’t worth as much. The same goes for websites. When a site links to your website it’s like that website saying that your website is worth visiting. It is of course very hard to make high profile sites link to a website, so often people will pay a bunch of small websites to give them a referral. This is a very common practice and is accepted by Google, but you need to remember is that Google is very smart and can often tell when the link is genuine.

If you have a blog that is all about cooking and in the middle you get paid to place a link to a casino website. Casinos have nothing to do with your niche and 99% of the time these articles will either sneak the link in or blatantly promote it with something like “While you enjoy this meal, why not checkout this online blackjack”. You are really just providing a backlink and wrapping it up in an article. Google consider this spam and if you get caught it could generate penalty toward your website. There is a line between a spammy guest post and a genuine one and you need to be able to identify them. If you run a site dedicated to movies, and a small indie movie producer asks you to promote his upcoming movie with a link then by all means do so if you want. The niche matches and it’s a genuine request. You need to determine why they want the link. If it’s to promote a new product or help boost their business, then there is nothing wrong with this. If you personally think its worthwhile for your readers then its all good. If the purpose of the link is to increase the websites SEO performance and increase search engine results, then stay well away. The small amount of money you get from these links isn’t going to be worth loosing your entire website. It’s pretty much impossible to build a successful website these days if the site doesn’t show up in search engine results.

Sharepoint Logo

This tutorial will show you how to programmatically create a subsite in Sharepoint. This can be done a few different ways and if you have server access you may prefer to do this on the server side, but you can just as easily create one using the Client-Side Object Model.

You can do this using a standard C# console application. For this example I used Visual Studio 2013 with .NET 4.0. You will need to include 2 assemblies in order for the code to work.

If this code throws an error then you will need to add the reference to your project. For me, I was not able to find Microsoft.Sharepoint but when I added the .client assembly it worked.

Thats it! The code above is all you need to create a new subsite. If you make a mistake and want to change it, you can also do this quite easy using similar code. You can modify pretty much everything on a subsite, but the URL becomes read only so you cannot change this once it has been set.

This is all you need to be able to add a subsite and to be able to edit it. logo

File downloads can be a bit of a nuance sometimes as web browsers often support a lot of document types. Simply adding the file path to the href of a html element, wont be enough for you to be able to download the file. There are dozens of work arounds to make this work, but using an ASP.NET ashx handler is definitely one of the cleanest methods to do it using code.

I will paste the contents of the entire ashx file below as the script is very simple. This solution will only work if you are using the non razor MVC models that are part of the ASP.NET framework. First you will need to create a new “Generic Handler” this will create a file with a .ashx extension. Once this is done you can point all of your links to this page when you want to download a file. There are many ways you can direct the downloads to this page. To keep things very simple, I have setup the script to accept the file path in the URL of the request.

In order to make the request work you will need to urlencode the value that is being passed into the url. The following code will be all you need to setup the url.

You could alternatively use javascript or pretty much anything that is capable of generating a request to your download script. This method has massive security risks, so please take this into consideration. This code will be enough to get a working prototype for you to built upon. This should never be used in any public facing code without some security measures being implemented to stop people tampering with the URL.


Alexa is a very popular source of tracking your websites popularity and traffic across the web. Its metrics are generated based on a few different factors, but for most people it will be based on a toolbar that the user has installed on their web browser. Website owners often put a lot of work into making sure their Alexa rank is as high as possible, but why? Does Alexa boost SEO?

Unfortunately there is no 100% guaranteed answer here. Google keeps its search engine ranking algorithm secret for a very good reason. If people know what Google checks, they will artificially inflate this statistic and unnaturally boost a website. When it comes to how Alexa affects search engine results, it is unlikely, but a good rank usually means your site is doing well and here’s why.

Traffic on your website is a good signal of a good website. If a site has 1 million daily visitors and another has 10 visitors, it is safe to assume that the site that is getting 1 million visitors, is better and more popular. Google monitors this kind of thing and will of course make the most popular site rank higher than the site that is less popular. Alexa rank will reflect this popularity, and is a great for you and other humans to see how popular your site is. Google is capable of tracking traffic on its own, so it is unlikely that it uses Alexa to influence its results, but that doesn’t mean you shouldn’t be wanting to get a good Alexa score for your website.

Humans are the ones that use Alexa. Marketing and advertisers will often check this site to see how popular your website actually is. If your site scores well, it will be seen as a valuable site and people will approach you to advertise their products on your website. This is almost as valuable as good SEO as it will give you a solid source of income for your website. So the question that might come from this is, how do you increase traffic to your website without SEO?

Getting traffic to your site can be difficult when you have a new website. You need traffic to get good SEO ranking, but its hard to get traffic when your site isn’t showing up in search engine results. It’s the catch 22 that ever website owner is going to deal with. Buying reliable traffic is a solution to this, but there are a lot of sources that send robots to your site which don’t help at all. There are many websites out there that offer traffic, one of which is Growtraffic. They offer affordable traffic that really boosts your websites online presence. For those who are looking to get a boost in traffic while you are working to increase your SEO and online presence, this can be a valuable source for you.

So to get back to the original question, does Alexa boost SEO? The answer is no, but it is a great way to check if your SEO efforts are working. A good Alexa rank will usually indicate good website SEO and performance. logo

This can be done in the RouteConfig.cs. You can set the default route that will be used to display the home page. You can find this file in Project->App_Start->RouteConfig.cs. The config inside this file will let you set default home page for ASP.NET razor MVC websites. The contents of the default file should look something like this.

The line that you need in particular to change the default homepage of an ASP MVC site is the defaults section. Change the name of the controller to whatever you want. The action for this will be the name of the method that you want to call within that controller. Once you have added this information your server should now be displaying this page as the default home page for your site.