-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trailing slashes fixed (URL should have end slashes in SEO) #23
base: master
Are you sure you want to change the base?
Conversation
It looks like that is checking for a path equal to "/" and not any path ending in "/". Also it looks like the comment for that line is:
So I think that has a different purpose than what you described unless there is a different piece of code that is adding a trailing slash. |
@thoop I know that code. |
} | ||
return $this->client->get($this->prerenderUri . '/' . urlencode($protocol.'://'.$host.'/'.$path), compact('headers')); | ||
$host = $request->getHost(); | ||
// Set path to request URI for fix trailing slashes (URL should have end slashes in Seo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether a URL should end in a slash or whether a website has URLs that end in a slash or not should be up to the website and not enforced in this middleware since that could break things for people already using this without a trailing slash.
return $this->client->get($this->prerenderUri . '/' . urlencode($protocol.'://'.$host.'/'.$path), compact('headers')); | ||
$host = $request->getHost(); | ||
// Set path to request URI for fix trailing slashes (URL should have end slashes in Seo) | ||
$path = $request->getRequestUri(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually add a trailing slash? It looks like you only removed the slash between $host and $path since I assume getRequestUri
returns the path with the "/" at the beginning of the string? Is there documentation anywhere on getRequestUri()
vs Path()
?
URL should have end slashes in SEO.
URL without end slash should redirect with 301 status to URL with end slash.
E.g. https://github.com/jeroennoten/Laravel-Prerender redirect to https://github.com/jeroennoten/Laravel-Prerender/
So
$path
changed to request URI.What's the use of this codes?
I think It just removes end slash from home page that It's not good for Seo