2 versions of each page - seo

I have created my blog using Jekyll. I have been told my site is indexing 3 URL's to some pages, which would be classed as duplicated content to Google. I have noticed I can visit:
https://villaagogo.com/guide/universal-orlando-resort/halloween-horror-nights-2017/ , https://villaagogo.com/guide/universal-orlando-resort/halloween-horror-nights-2017 and also the index.html extension after each slash.
I am not sure how to fix this. I have the following in my config file:
permalink: /:categories/:title/
and in the of the template I have the following:
<link rel="canonical" href="{{ page.url | replace:'index.html','' | absolute_url }}">
Do I need to do anything else? The same occurs on the main page of the blog too, with and without the slash /blog/ and /blog
Any help would be great.
Thanks
Chris

The canonical is good and should be obeyed, but you should also redirect one to the other with a 301 redirect.
It looks like you're good to go though:
curl -I "https://villaagogo.com/guide/universal-orlando-resort/halloween-horror-nights-2017"
HTTP/1.1 301 Moved Permanently
Content-Length: 206
Content-Type: text/html; charset=UTF-8
Location: https://villaagogo.com/guide/universal-orlando-resort/halloween-horror-nights-2017/
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Mon, 28 Aug 2017 23:41:18 GMT

Related

htaccess HTTP 200 message body

How can i add a message body to my HTTP 200 response from .htaccess ?
like Hello world! :
HTTP/1.1 200 OK
Date: Sun, 10 Oct 2010 23:26:07 GMT
Server: Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g
Last-Modified: Sun, 26 Sep 2010 22:04:35 GMT
ETag: "45b6-834-49130cc1182c0"
Accept-Ranges: bytes
Content-Length: 13
Connection: close
Content-Type: text/html
Hello world!
This isn't something you do in .htaccess alone. Short of directly requesting a file that returns the "Hello World!" response, what you can do in .htaccess is rewrite the requested URL to a file that returns the "Hello World!" response.
For example, given a request for http://example.com/foo then you could rewrite this request using mod_rewrite in .htaccess to a plain text file that outputs the response. For example:
In /.htaccess:
RewriteEngine On
RewriteRule ^foo$ hello-world.txt [L]
In /hello-world.txt:
Hello World!
Of course, you could simply request http://example.com/hello-world.txt directly (unless you add additional directives to redirect such direct requests).

How to fix wrong redirect utl 301 in htaccess?

I used htaccess to limited ip which can connect to admin and user login page.
RewriteCond %{REMOTE_ADDR} !=127.0.0.1
RewriteRule (admin|user)$ http://redirect_example.com [R=301,L]
But the problem here is I used 301 redirect which mean when I can't change url http://redirect_example.com to another url. It's has already cached. My curl -I http://example.com/user result:
HTTP/1.1 301 Moved Permanently
Date: Fri, 17 Feb 2017 03:46:19 GMT
X-Content-Type-Options: nosniff
Cache-Control: max-age=1209600
Expires: Fri, 03 Mar 2017 03:46:19 GMT
Content-Length: 313
Content-Type: text/html; charset=iso-8859-1
Location: http://redirect_example.com
Age: 251965
X-Cache: HIT
X-Cache-Hits: 56
Connection: keep-alive
How do I change http://redirect_example.com to another url?
Caused by Varnish. You should ban the cache by run the command:
varnishadm
Then ban the cache by domain:
ban req.http.host ~ "redirect_example.com"
It's just cached in your browser. Clear your browser cache. You can use 302 redirects while testing to help with this.

Phalcon simple REST API tutorial issue

I'm trying to make this simple tutorial work on my server but I'm facing a problem which I don't know how to solve.
Suggested directory api is created and only index.php and .htaccess files.
Content of .htaccess file is the same as in tutorial but index.php is altered so it looks like this:
<?php
$app = new Phalcon\Mvc\Micro();
$app->get('/api/robots', function() use ($app){
$response->setJsonContent(array('status' => 'OK', 'messages' => 'This works'));
echo "Izvrsena function";
return $response;
});
$app->handle();
?>
But when I try to send GET request to address:
http://SERVER_IP_ADDR/test-api/api/robots
using hurl.it and I get the following response:
404 Not Found 297 bytes 175 ms
HEADERS
Connection: close
Content-Length: 297
Content-Type: text/html; charset=iso-8859-1
Date: Fri, 27 Mar 2015 17:44:46 GMT
Server: Apache/2.2.15 (CentOS)
BODY view raw
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>Not Found</h1>
<p>The requested URL /test-api/api/robots was not found on this server.</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at SERVER_IP_ADDRESS Port 80</address>
</body>
</html>
I must note that my apache configuration file is a default one.
1. .htaccess file location
Your .htacces file should be in your test-api/ directory.
2. mod_rewrite enabled
You should enable mod_rewrite in your Apache2 server configuration, here is kinda useful ansewer, but prlly you will have to search for something corresponding to CentOS.
3. Enable Allow-Override
To make it possible for .htacces files to take effect, thanks for providing headers and info about configuration - according to this place, you probably have disabled Allow-Override directive, as of using Apache 2.2. If it is your developing server, feel free to set it to new default as of 2.3.8+ version: Allow-Override All, and .htaccess files should start to work. Server restart will be required.

apache mod_cache stores but doesn't serve url with 'Transfer-Encoding: chunked'

I have setup apache2 with django and mod_wsgi in Debian Wheezy. I enabled mod_mem_cache with this configuration:
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 400000
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 500000
CacheIgnoreNoLastMod On
CacheIgnoreHeaders Set-Cookie
</IfModule>
based on the fact that MCacheMaxStreamingBuffer is the smaller of 100000 or MCacheMaxObjectSize as stated in the docs.
When I try hitting a page with size 3.3KB I get these response headers in firebug:
Connection Keep-Alive
Content-Encoding gzip
Content-Type text/html; charset=utf-8
Date Wed, 27 Aug 2014 14:47:39 GMT
Keep-Alive timeout=5, max=100
Server Apache/2.2.22 (Debian)
Transfer-Encoding chunked
Vary Cookie,Accept-Encoding
and the page isn't served from cache. In the page source there is however the correct header 'Cache-Control: max-age=300,must-revalidate' but doesn't show up in firebug.
In apache log I only see correctly:
[info] mem_cache: Cached url: https://83.212.**.**/?
With another test page that I created outside of django that doesn't have chunked encoding as a header, caching works fine. Why is the page not served from cache? Has anyone seen something similar?

Disabled Unnecessary HTTP Methods

I'am doing a web based application and what I did is to disable some of the HTTP methods are not necessary for the website specifically: OPTIONS, HEAD and TRACE.
I put this on the httpd.conf of my xampp to test if this works:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} !^(GET|POST|PUT)
RewriteRule .* - [R=405,L]
Now my problem is how would i know if it is really deactivated or this particular setting is working properly? Are there tools that could facilitate this. I'm just new to server side administration.
Please someone help me.
You could just use telnet/netcat to verify this. Assuming that you're not using HTTPS, something like below should work perfectly to test:
$ telnet www.google.com 80
Trying 74.125.239.49...
Connected to www.google.com.
Escape character is '^]'.
OPTIONS / HTTP/1.1
Host:
HTTP/1.1 405 Method Not Allowed
Content-Type: text/html; charset=UTF-8
Content-Length: 962
Date: Tue, 17 Dec 2013 20:18:22 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic
Rinse and repeat for any other method that you have disabled, and that will tell you for sure whether the configuration works or not.