Sunday, February 28, 2010

.htaccess file 301 redirect - to avoid duplicate content

Ya - I'm an ASP.net programmer, but every now and then I do a bit of php or other maitenance..

The other day I had to update a website for SEO. I noticed that this guy had two domains pointed to the same website... and that you can crawl them exactly the same.

Unfortunately, this gets a duplicate content penalty so I had to update the .htaccess file to correct this and do 301 redirects. Here are the lines of code needed to do this if you ever need it:

RewriteCond %{HTTP_HOST} ^^(www\.)?dontneedthis\.com$ [NC]
RewriteRule ^(.*)$ http://www.spiderweblogic.com/$1 [R=301,L]


Of course - change spiderweblogic to your website...

TIP: don't kill any existing .htaccess file. Just append this code towards the top. (You may not see it if you use a ftp program.)

Friday, January 15, 2010

Pinging Blogs

For best results after posting blogs...ping them. That way blog search sites know you have updated content.

Here are some free services that ping blogs on request:

http://www.feedping.com/
http://pingomatic.com/

If you roll-your-own blog, you may want to use pingomatic.com - since they are easy to integrate as a back-end service.

Monday, September 28, 2009

301 redirect windows server - for HTML pages

I was working on moving a website over... The old site was html only - the new one is ASP.net. The puzzle was how to get the 301 redirects set up on a windows box? I have done it in code-behind... if it is an ASP.Net page... and with classic "asp" pages.

HERE is what I found
IIS Redirect
In internet services manager, right click on the file or folder you wish to redirect
Select the radio titled "a redirection to a URL".
Enter the redirection page
Check "The exact url entered above" and the "A permanent redirection for this resource"
Click on 'Apply'

more on 301 redirects

Sunday, August 2, 2009

Dynamically Loaded Controls Disappear ASP.Net C#

I have been working with dynamically loaded Web User Controls.

However,I just found that they disappear after a postback... The basic solution is to reload them after postback.

Oh well...

Related articles (with info/tips/code):

[Telerik has good tips on using viewstate to help]

http://www.telerik.com/help/aspnet/ajax/ajxloadusercontrols.html


http://aspnet.4guysfromrolla.com/articles/092904-1.aspx

http://weblogs.asp.net/infinitiesloop/archive/2008/04/23/truly-understanding-dynamic-controls-by-example.aspx

Javascript Cross Browser Back Method

I have been working on a quick CROSS browser "back" method in JavaScript. It is really simple...

The history.go(-1) only worked well in IE. This double method worked well in IE, Firefox and Chrome. It checks if it knows how to do the "referrer" method. If not... it uses the history.go


[a href="#" onclick="if(document.referrer) {window.open(document.referrer,'_self');} else {history.go(-1);} return false;"]continue shopping[a]

Of course, you should use a "<" instead of "[" ... Blogger had issues when I posted the full link.

Friday, June 12, 2009

MySql Text Field - Truncating Data?

Every now and then you run an application that really tests the constraints of data types. I just encountered this....

I just found out that in MySql "BLOB TEXT A BLOB or TEXT column have a maximum length of 65535 (2^16 - 1) characters". I was encountering some data errors with large text chunks - and finally found that they were being truncated silently... When I counted the characters - yes... that was the issue.

Arggg!

But there is a simple solution... LONGTEXT or LONGBLOB fields can handle the larger bits of data - if this is expected. This gives you approx 4 Gig of space to work with. Good to know.

Tuesday, June 9, 2009

Standard Web Page Width

I have been building web pages for over 6 years... and have been using a standard web page width of 778px for 800px monitors, unless the client requests otherwise. The concept is to avoid (left/right) scrolling and make a good user experience.

Most of the justification came from the analysis/tips in Jakob Nielson's book on "Homepage Usability" - dated in 2002. Most other articles I've read suggest this... but the trend is changing, as these monitors become fewer.

Floating widths are cool - and useful. But they take longer to develop and I only do those on request, at an extra fee. However, since my statistics show that less than 2% use 800 px monitors, I am about to change my policy...

But what width to use? Of course I will build for the 1024px monitors... the next size up. This is the largest percentage for screen resolutions now - about 34%. But I am considering only using 960px width for the regular content. That will allow for those who don't open their browser all the way. And it will allow the background colors/gradients to properly frame the page.

More info:
http://webdesign.about.com/od/webdesign/a/aa080904.htm

http://funbytebitstop.wordpress.com/2007/03/01/775-px-make-it-your-default-webpage-width/

http://www.jimdegerstrom.com/blog/2008/07/standard-web-design-page-width.html

Screen Resolution Statistics
One of my websites gets 7,500 visitors per month on average...
21% use screen resolution 1024x768
18% use 1280x800
10% use 1280x1024
10% use 1440x900
7.6% use 1366x768
7% use 1680x1050
3.4% use 1920x1080
3% use 1920x1200
2.8% use 1600x900
2.25% use 1152x864
1.6% use 1280x768
1.5% use 1280x720
1.25% use 1360x768
0.9% use 800x600
0.9% use 1280x960
....

So it seems that less than 1 in 100 use the smaller 800 X 600 monitors...
Any thoughts?