Showing posts with label how to create an easy personal home page. Show all posts
Showing posts with label how to create an easy personal home page. Show all posts

Tuesday, November 21, 2017

how to create an easy personal home page CMS with SEO pleasant hyperlinks

how to create an easy personal home page CMS with SEO pleasant hyperlinks how to create an easy personal home page CMS with SEO pleasant hyperlinks Contents fundamental CMS Hypertext Preprocessor Tutorial Hypertext Preprocessor search engine optimization friendly URL hyperlinks All Roads lead to Rome: handling all Requests with One Script Welcome to index.php the way to Get the particulars of friendly website positioning URL php Script Create search engine marketing hyperlinks in the Administration Interface down load the finished search engine optimization Hypertext Preprocessor Script CMS kit SEO (search engine optimization) is awfully important for any internet web site today. if you don’t optimize your web web page no one will locate you on engines like google. and there is no use for a web website if no person can locate it. This tutorial explains only one point of SEO, which is to have pages with pleasant URLs. many years ago we have been all mad about phpNuke or Joomla, but they’d one nasty problem, the web page links appeared to gruesome: “index.personal home page?id=653&page_type=blog&lang=en”. They have been very complicated to class and that they all seemed the same. search engines like Google additionally don’t like these sorts of URLs. Then a new generation of CMS came out, some the usage of for instance the CodeIgniter framework, others the use of Moodle or Drupal. however they additionally had their personal web optimization issues. You nonetheless can discover them online these days, however a brand new hero came out very quickly after that was WordPress. One pitfall any of those CMSs have is that they’re made for established purposes sites. for instance WordPress begun as a running a blog gadget, now offers plug ins to make any sort of net sites. but for a gadget like that you want massive courses, too a good deal code, too an awful lot plug-ins and too a lot maintenance. one more issue is that you just cannot sell GPL licenced code for valued clientele devoid of opening the source code. they will finally hear someplace that you made them pay for an open supply utility, and that they may not like that. Given this, doubtless the ultimate answer is to make your personal CMS, light-weight. which you can licence it as ever you need, you understand it very neatly as you wrote it and it’s good to have a custom solution with a custom database structure. The issue we are able to face is that we’ll return to the “index.personal home page?identity=653&page_type=blog&lang=en” issue. So lets see the way to make an easy CMS with search engine optimisation pleasant URL’s. search engine optimization pleasant hyperlinks must have the page title in it, they need to be readable and that they need to get rid of index.php. for instance “how-to-make-web optimization-friendly-hyperlinks” or “making-a-class-for-personal home page-courses-web site”, as that you could see has no index.Hypertext Preprocessor in it, there isn’t any file name extension what so ever in the end, it is awfully readable and you can get the title from the hyperlink. One vital element is that these links need to be dynamically generated, as this is the concept of having a CMS. So let us get lower back to “index.Hypertext Preprocessor?id=653&page_type=blog&lang=en”, once we resolve it we’ve “index.php”, it is the leading Hypertext Preprocessor file processing for all requests in the CMS. we’ve the identity of the article or the page, we now have a web page type, during this case “blog”, but it surely can be anything else, product, article or blog. finally we now have a language, during this case it is for websites with a couple of language, in this tutorial i’ll pass the language. We need to mimic the equal performance in our “how-to-make-web optimization-friendly-links” link, however we do not need any aspect of these up, so here’s how we do it: Redirect all URL requests to one vicinity for processing. determine a table of hyperlinks and get the statistics we need, identification and type. depending on the factor classification we name an appropriate plug-in to technique and reveal the statistics. If we need all URLs to be dealt with with the aid of one script, let’s say index.Hypertext Preprocessor, we want then precise configure the .htaccess file. We need to have an Apache on our internet hosting or another web server that gives equal control of configuration by the use of a .htaccess file. The .htaccess file have to enable the URL rewriting module the use of the RewriteEngine directive. Then just add a rule for all site visitors to head to index.personal home page. RewriteEngine On RewriteBase /cms/ RewriteCond %REQUEST_FILENAME !-d [NC] RewriteCond %REQUEST_FILENAME !-f [NC] RewriteRule ^(.*)$ index.php?pid=$1 [QSA,L] it is essential to set these directives carefully. in the illustration above i’m redirecting all traffic to index.personal home page except a person accesses a personal home page or HTML file directly, or if the request route is in folders images, CSS or JS. it truly is the place my photos, CSS and JavaScript information usually are. the use of the [NC] flag motives the RewriteRule to be matched in a case-insensitive manner. it is, it would not care even if letters appear as higher-case or lessen-case within the matched URI. Now we acquired all site visitors be handled to index.Hypertext Preprocessor, right here we should do a widely wide-spread verify: who got here here and what he wants. index.php could be like a site visitors manager. We should capture the arrival link and question a special table in a MySQL database with all our prior to now generated hyperlinks, we get the identification and type of the web page associated with the link URL. allow us to see the table structure first. CREATE table IF not EXISTS `members` ( `memberID` int(11) now not NULL AUTO_INCREMENT, `username` varchar(255) now not NULL DEFAULT ”, `password` varchar(60) now not NULL DEFAULT ”, fundamental KEY (`memberID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; INSERT INTO `participants` (`memberID`, `username`, `password`) VALUES (1, ‘admin’, ‘$1$8I4.v32.$bV9MWNrNAFA1bdD/JS/FW1’); // Username – admin , Password – demo —————————– during this case point will replicate the identity of the web page and urltype as its classification. Now let us see the php code: listPages(); $pid=$_GET[pid]; if($pid==””) $pageDetails=$pageClass->particularPageSlug($pageList[0][‘URL’]); else $pageDetails=$pageClass->particularPageSlug($pid); if($pageDetails[id]==””) header(“area:404.Hypertext Preprocessor”); ?> As that you can see, first we bought the request URL, “$pid”. Then we queried the database with a press release to get the category and id of our point. If the aspect does not exist we redirect the code to a custom “web page not found” web page. After getting the type and identity of our point, it is effortless to do the leisure. We deserve to make a different question to get the aspect particulars counting on the URL classification. So let us suppose we’ve two kinds of points in our CMS: products and blogs. if it is a weblog we query the blogs table and require the weblog.Hypertext Preprocessor file to method the web page. whether it is a product we query the products desk and get its details, then we name products.Hypertext Preprocessor to show that template. These are the items and blogs tables: CREATE desk IF now not EXISTS `pages` ( `pageID` int(eleven) now not NULL AUTO_INCREMENT, `pageTitle` varchar(255) DEFAULT NULL, `isRoot` int(eleven) now not NULL DEFAULT ‘1’, `pageCont` textual content, simple KEY (`pageID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; ———————————- CREATE desk IF not EXISTS `webpages` ( `identification` int(9) not NULL AUTO_INCREMENT, `Title` varchar(255) no longer NULL, `URL` varchar(255) no longer NULL, `key phrases` varchar(150) now not NULL, `Description` varchar(250) DEFAULT NULL, `PageDetails` varchar(5000) DEFAULT NULL, `PageName` varchar(90) DEFAULT NULL, `PageType` int(3) DEFAULT NULL, simple KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ; public feature particularPageSlug($id) $listing=”opt for * from webpages where URL=’$identity'”; $outcomes= $this->query($record); $count= $result->num_rows; if($count < 1)else while($row= $outcomes->fetch_array(three)) return $row; Create SEO hyperlinks within the Administration Interface we now have considered how to redirect URL requests to index.personal home page and demonstrate the requested product or weblog depending on the URL. but now we deserve to see how in administration we create these links and fill them in “urls” desk. When including a weblog we will insert all statistics in the “blogs” table, so we will deserve to get the insert weblog post identification. we can use that identification in our “urls” desk. We additionally want the title to create the link for it. that is where we can use create_link() characteristic. real_escape_string($facts[“PageDetails”]); $records[“URL”]=$this->slug($facts[“URL”]); if($this->dulicatePage($records[“URL”])<1) $keys=array_keys($data); $values=array_values($information); date_default_timezone_set (“Asia/Kolkata”); $table=”webpages”; $query=’INSERT INTO ‘.$table.’ (‘.implode(‘, ‘, $keys).’) VALUES (“‘.implode(‘”,”‘, $values).'”)’; $outcomes= $this->query($query) or die($this->error); if($outcome) unset($_POST); return $message->getAlert(“page is introduced “, “success”); else return $message->getAlert(“Error while including web page”, “error”); else return $message->getAlert(“Already Exists”, “error”); ?> As that you may see we all the time insert the weblog first, then get it’s inserted identification, and get the title. Then we create a new URL from the title the use of create_link characteristic that will insert a new row in urls table. And now lets see how “slug” function looks like: query($examine); $count= $effect->num_rows; if($count < 1)return 0;elsereturn $count; ?> The “slug” characteristic receives the title of the blog or the product and makes it as a reduce case string. Then it removes any particular characters with a series of str_replace strains and replaces any whitespaces with “-” character. The outcome is a search engine optimization friendly URL, which we will deserve to assess if it is already used in the URLs desk. We don’t need any duplicates, all URLs should be entertaining in that table. If the URL is found, we return the effect to be inserted. In case we have already got that URL, we then use dulicatePage feature to verify the URL Slug reproduction. Then we call “slug” recursively except we get a distinct URL for insertion. This code is written for the academic in a simple method so you can remember the idea. It is not to be taken as whatever smartly tested in a real CMS. For greater particulars that you may determine the detailed example at right here. download the finished web optimization php Script CMS package growing person and search engine optimization friendly URLs isn’t challenging. Many current CMS deal with that for you. but if for some intent you deserve to put into effect your own solution with desiring a full blown CMS, this text presented the fundamental steps so you might follow to clear up this remember devoid of depending on other utility. which you can download and deploy the the complete package described listed here right here as a zip archive or install it the usage of the personal home page Composer tool. in case you preferred this text or you have any questions, simply put up a remark to the article right here.