404 redirect

Since I have changed the website. Google still keeps the search results of the previous old website. In that case, people finds the old links/broken links that still exist on the search engine. Its Bad for the website’s impression, when people see “404 ERROR, THE PAGE WAS NOT FOUND”. Its a frustrating message. But it’s still good, because even the links are old or broken, still people are finding TO MY HOME.SE on the search result on GOOGLE, YAHOO, BING and so on.

I made this problem into advantage. I made a 404 redirect page. Click here to see the page. So now, when there will be any printing mistake after the website’s link and “/”. People will be redirected to customized 404 error report page.

Advantage:

In my custom error page, i have put all necessary information, that my visitors need. Even if they clicked in the broken links, they will not be bothered, they will be happy to visit the website and will come back again. So that’s the thought.

How you do it for your own website:

Its really simple and easy to fix. You need to make a 404 custom static or dynamic page(My favorite editor is NOTEPAD ). Then you go to your server. For an example I host my websites in East West Host.com. Because the domain and hosting is so good price and it’S CPANEL is so easy, and you can do everything by yourself. Upload your custom 404 error page, by your favorite FTP server client software(I use File Zilla), to your ROOT folder. And you must also know that, your server must be unix/linux operated. Mine is linux. And you must create a .htaccess file, to give the command to the server, to redirect all pages from the links, which doesn’t exist or misspelled. in my .htaccess file, I wrote this

ErrorDocument 404 /404.html

So here is the final page so far. Click here.

Great. That’s all you need to make it happen. Hope my article helps. Thanks for reading. Be updated.

404, Baidu, Fel 404, Felsida, Google, LiveSearch, Sökmotorer, Yahoo

Dynamically Generating Meta Tags through PHP

Hi,

If you can work out the logic for your PHP code, then you could add your custom code to your theme’s _preprocess_page function. I did this recently on a site to pull the keywords from both the node title and its taxonomy terms, and add the HTML output to a new page variable – $vars['meta_tags'] – which I then output in the theme’s page.tpl.php. hope it helps.

–starts here–

// This snippet goes in the theme's _preprocess_page function.

/* get site mission on all pages */
$vars['slogan'] = variable_get(‘site_slogan’, ‘Shariful is an expert on internet marketing, comfortable helping small and medium business’);

/* Build header meta tags */
$meta_tags = array();

// Use slogan for description
$meta_tags['description'] = array(‘type’ => ‘name’);
$meta_tags['description']['content'] = $vars['site_name'] .’ (Shariful) – ‘. $vars['slogan'] .’ is an expert on internet marketing, comfortable helping small and medium business.’;

// Build keywords from node title
$meta_tags['keywords'] = array(‘type’ => ‘name’);
$meta_tags['keywords']['words'] = array(‘this’,'that’,'the-other’,'miscellaneous’,'keywords’,'always’,'applicable’);
$node_title_words = explode(” “, $vars['title']); // get possible words from node title
$keywords_ignore = array(‘and’,'in’,'using’,'is’,'if’,'the’,'by’); // words to be ignored
foreach($node_title_words as $title_word) {
$title_word = strtolower($title_word);
// Check that word isn’t in ignore list, or already in list of default keywords
if(!in_array($title_word, $keywords_ignore) && !in_array($title_word, $meta_tags['keywords']['words'])) {
$meta_tags['keywords']['words'][] = $title_word;
}
}
// concatenate word list with commas
$meta_tags['keywords']['content'] = join(‘, ‘, $meta_tags['keywords']['words']);

// Hide horrible MS Image toolbar thing
$meta_tags['imagetoolbar'] = array(‘type’ => ‘http-equiv’);
$meta_tags['imagetoolbar']['content'] = ‘no’;

// Build HTML output
$meta_tags_output = ”;
foreach($meta_tags as $tag_name => $tag_data) {
$meta_tags_output .= ”.”\n” ;
}
$vars['meta_tags'] = $meta_tags_output;

–ends here–

The ‘description’ just uses the site slogan, and the ‘keywords’ uses some default terms plus words found in the page title (which is usually inherited from a node).

I’ve tried to remove some of the specifics related to the site I use this for, but still keep things comprehensible. Basically, I build an array of meta tags which are then compiled into a page variable which can be printed in the page.tpl.php:

–starts here–

[...]
<meta http-equiv="content-language" content="<?php print $language->language ?>" />
<?php print $meta; ?>
<?php print $meta_tags; ?>
<?php print $head; ?>
<?php print $styles; ?>
[...]

–ends here–

There should probably be some more checking in there for duplicate words, but hopefully it should give you some ideas…

How to allow comments on wp

I was in need to allow comments on one of my wp sites. and i was thinking a bit, how can i allow that. and i was searching on internet, how other people are thinking about it. and i saw lots of people asking about this issue. i was searching first couple of pages on the forums, most of the programmers were speaking like, “i know how to fix it, i ain’t gonna share though”, and this kind of mentality bothers me. programers are not suppose to be old school boys or commercial. They should be smart enough to understand that, this market is too big. they only way to compete this market, is to be helpful and to be nice. anyways guys, i dont bother to share this kind of issues with you. I love to help. here is the solution below.

remember one thing that, its allowed from the core software. but the trick is in the theme. so far, you need to work on that.

Try yourself, save time.

You need to edit the page.php file for your theme and insert the following: <?php comments_template(); ?>

In the default theme it slips in best just before the close of the <div id=”content”> tag on line 17 (I’m looking at theme version 1.6).

That’s all there is to it. You might also want to edit the comments.php file of same theme and add <?php if (!is_page()) { ?> before the line that reads <!– If comments are closed. –> and <?php } ?> after it. (It’s around line 57/58, again in default theme version 1.6.) This’ll stop the “Comments are closed” message from appearing on pages which to me doesn’t quite fit given the context.

Hope that helps someone given this was 2 months ago. Took 2 minutes of my time and is a darn sight lot more useful than the earlier “It’s easy but I ain’t gonna share” attitudes :/