Jump to content

how to display seo friendly content?


lovephp

Recommended Posts

Ok so I created this blog and also managed to successfully store the title of the topic as blog_url now how on earth I fetch it on browser to display as

 

www.mysite.com/TOPICID1/2015/06/20/my-topic-for-the-blog.php

 

Help out from here please in a secure way.

 

Regards

Link to comment
Share on other sites

ok i got it wroking on wamp server but now that i try it on my webhost one a subfolder as /blog i am getting 404 page not found error :-(

 

 

here is the rewrite rule in .htaccess file

RewriteEngine On

RewriteRule ^blog/([a-zA-Z0-9-/]+)$ article.php?$1
RewriteRule ^blog/([a-zA-Z0-9-/]+)$ article.php?$1

in my root folder i also have another .htaccess file which is as follow

RewriteEngine On
 
DirectoryIndex index.php
ErrorDocument 404 http://www.site.com
ErrorDocument 403 http://www.site.com

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


<IfModule mod_deflate.c>
  <FilesMatch "\.(css|x?html?|php)$">  
  SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css A100
ExpiresByType text/html A100
</IfModule>

what is wrong here?

 

the url is as following

 

http://www.site.com/blog/ID1/2015/06/22/neque-porro-quisquam-est-qui-dolorem-ipsum-quia-dolor-sit-.

 

 

and in article.php this is how i am fetching the results

 

<?php
session_start();
require_once("dbcontroller.php");
$db_handle = new DBController();
include("log.php");
$url = mysql_real_escape_string($_SERVER['REQUEST_URI']);
$url = str_replace('/blog/', '', ucwords($url));
$sql=mysql_query("SELECT id,blog_title,blog_image,blog_youtube,blog_article,created,views  FROM article WHERE blog_url='".$url."'");
mysql_query("UPDATE article SET views = views +1 WHERE blog_url ='".$url."'");
$count = mysql_num_rows($sql);
$row=mysql_fetch_array($sql);
    if($count <1){
        header("ERROR: 404");
        exit();
    }
?>



 

Edited by lovephp
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.