Welcome Guest, Not a member yet? Register   Sign In
Question about $config['url_suffix']
#1

I am using CI-3rc2. When the $config['url_suffix'] = '.html' is used codeigniter accept urls with the suffix ( codeigniter/this-section/this-page.html ) and urls without the suffix ( codeigniter/this-section/this-page ). That means duplicated content for search engines. Is there a way to fix this to avoid duplicated content.

I have this on the .htaccess

<IfModule mod_rewrite.c>

## MIME types for Video
AddType video/webm .webm
AddType video/mp4 .mp4
AddType video/ogg .ogg
AddType video/ogg .ogv
AddType video/x-flv .flv

## Don't listing directory
Options -Indexes

## Follow symbolic links
Options +FollowSymLinks

## turn mod-rewrite on
RewriteEngine On
RewriteBase /

## Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

## Prevent directory browsing
DirectoryIndex index.html  index.php

## change php ini values
php_value upload_max_filesize 1000M
php_value post_max_size 1000M

## Removes access to the system folder by users.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond $1 !^(index\.php|assets|img|uploads|robots\.txt|sitemap\.xml)$ [NC]

# Checks to see if the user is attempting to access a valid file, if this isn't true it sends the request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
   ## If we don't have mod_rewrite installed, all 404's can be sent to index.php, and everything works as normal.
   ErrorDocument 404 /index.php
</IfModule>

and this setting $config['index_page'] = '';

everithing work fine but I dont like the idea to have duplicated content.

I appreciated any help with this.
Thank You!
Reply
#2

well the simple yet quirky way to do this is to change all ur url's with html extension...so search engines wont duplicate your content, be consistent with your url and that should be good.
Reply
#3

(This post was last modified: 03-19-2015, 12:38 PM by Mel9pr.)

(03-19-2015, 11:46 AM)sajid19991 Wrote: well the simple yet quirky way to do this is to change all ur url's with html extension...so search engines wont duplicate your content, be consistent with your url and that should be good.

Yes you are right, and I ok with that... Thanks!

Thing is the suffix purpose is to hide or disguise your real application (.php .asp what ever...). However if CI cant' enforce the suffix when is in use by rejecting any url without the suffix with a 302 code then the suffix only serve for duplicate content. So people that don't care or don't know about duplicated content will get a bad score on search engines for that. So the user cant' hide the app type anyway because it may do more bad than good.
Reply
#4

If all of your links contain the .html, then that's what will be crawled by the SE's. If you have some with and some without, then you will run into duplicate content problems. This also isn't really an issue unless you add a suffix AFTER your app has been out there live and crawled. You should also have a canonical URL in the <head> of each page with the full url including the .html extension, which will tell google that that's the main page and it will ignore the same version of the page missing the .html extension.

You can also create an htaccess rule and redirect any url that doesn't have the .html extension to the same url but add the .html extension.
Reply
#5

(03-19-2015, 12:36 PM)Mel9pr Wrote:
(03-19-2015, 11:46 AM)sajid19991 Wrote: well the simple yet quirky way to do this is to change all ur url's with html extension...so search engines wont duplicate your content, be consistent with your url and that should be good.

Yes you are right, and I ok with that... Thanks!

Thing is the suffix purpose is to hide or disguise your real application (.php .asp what ever...). However if CI cant' enforce the suffix when is in use by rejecting any url without the suffix with a 302 code then the suffix only serve for duplicate content. So people that don't care or don't know about duplicated content will get a bad score on search engines for that. So the user cant' hide the app type anyway because it may do more bad than good.

Good point, @Mel9pr
Reply
#6

(03-19-2015, 02:51 PM)CroNiX Wrote: You can also create an htaccess rule and redirect any url that doesn't have the .html extension to the same url but add the .html extension.

That is a good idea. I'll try to find a rewrite rule to do that. CI have the ability to use only allowed characters ($config['permitted_uri_chars']) maybe in the future CI should use a function like that to verify the suffix to enforce it and make a 301 redirect if the suffix is in use and not present in the uri string. That way people don't have to deal with rewrite rules.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB