• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC

Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Changing news detail template and soft 404 errors
PostPosted: Fri Jun 24, 2016 10:31 am 
Power Poster
Power Poster
User avatar

Joined: Wed Aug 01, 2007 5:36 pm
Posts: 508
Hi all,
I have some pages calling news module with instruction like:
{news category="General" summarytemplate="Responsive_News_Summary" detailtemplate="Responsive_News_Detail"}

As result of this, URLs of news detail page are something like:

I want to get rid of last URL part and have nice URLs like:

To accomplish this, I have to remove "detailtemplate=..." instruction and create default template but what about SEO and soft 404 errors? Pages are already indexed but they are duplicated according to search engine because of same content.
One option is to edit .htaccess and create a 301 redirect but not all webmasters can access to it.

So here my CMSMS solution:
  1. Clone actual news detail template with a new name and make it default template.
  2. Create a new UDT named "moved301" with this code
    $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    $path = parse_url($url, PHP_URL_PATH);
    $pathComponents = explode("/", trim($path, "/"));
    $newurl = 'http://'.$_SERVER['HTTP_HOST']. '/'. $pathComponents[0] .'/'.$pathComponents[1] .'/'.$pathComponents[2] .'/'.$pathComponents[3] .'.htm';
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $newurl");
  3. Edit old template and remove all content (but don't delete template) replacing with {moved301}
  4. Done!

Search engine trying to access detail template using old URL will be redirected with a 301 status code to new (short) URL.

Hope it helps

Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Hosting Nation - Managed CMSMS Hosting