b-m-f
May 18, 2019, 7:41pm
1
Hello,
I am trying to set up a redirect.
At some point in the past my posts where at /post/{slug}
. This has changed and they now just live at /slug
. Since my blog is pointed to from some sources Id like to set up the correct redirects.
This is my rule to do this.
{"from":"^/post/(.*)/$","to":"/$1","permanent":true}
Unfortunately this results in https://maximilianehlers.com/post/testable_modules/ being rewritten to https://maximilianehlers.com/testable_modules// .
Is there anything I am missing here to not have the second /
appended?
Thanks for any help!
This is how I redirect, they work properly:
To homepage:
{
"permanent": false,
"from": "^\\/tag/name(\\/?)$",
"to": "/"
}
To other page:
{
"permanent": false,
"from": "^\\/tag/name(\\/?)$",
"to": "/tag/name1/"
}
Ghost forces all URLs to have a trailing slash:
opened 08:28PM - 29 Oct 17 UTC
closed 08:40PM - 29 Oct 17 UTC
The meta tag rel="canonical" on the home page has a trailing slash, though the b… log_url is without trailing slash? How can this be removed?
The canonical url should be http://example.com instead http://example.com/ for SEO purposes.
I use the latest Ghost version.
So your redirects are working as intended, but the url /testable_modules
gets redirected to /testable_modules
elsewhere
b-m-f
May 19, 2019, 5:02pm
4
hi @vikaspotluri123 ,
they almost work as intended. The problem I have is that 2 slashes are appended.
So instead of https://maximilianehlers.com/testable_modules/
I end up with https://maximilianehlers.com/testable_modules//
, which can not be found and then shows the 404 page.
Aah, the trailing slashes blended together
Can you check the redirects in incognito? Everything seems to be working here
C:\>curl -I https://maximilianehlers.com/post/testable_modules/
HTTP/1.1 301 Moved Permanently
Cache-Control: public, max-age=31536000
Content-Length: 51
Content-Type: text/plain; charset=utf-8
Date: Sun, 19 May 2019 17:05:31 GMT
Location: /testable_modules
Vary: Accept, Accept-Encoding
X-Powered-By: Express
C:\>curl -I https://maximilianehlers.com/testable_modules
HTTP/1.1 301 Moved Permanently
Cache-Control: public, max-age=31536000
Content-Length: 52
Content-Type: text/plain; charset=utf-8
Date: Sun, 19 May 2019 17:05:48 GMT
Location: /testable_modules/
Vary: Accept, Accept-Encoding
X-Powered-By: Express
C:\>curl -I https://maximilianehlers.com/testable_modules/
HTTP/1.1 200 OK
Cache-Control: public, max-age=0
Content-Length: 11624
Content-Type: text/html; charset=utf-8
Date: Sun, 19 May 2019 17:06:02 GMT
Etag: W/"2d68-Lsr0d3WtmfA8PC2BlR2iQRfL0/I"
Vary: Accept-Encoding
X-Powered-By: Express```
1 Like
b-m-f
May 20, 2019, 8:22am
6
Oh wow! I thought I tried this.
Thanks alot for trying this!
system
Closed
June 3, 2019, 8:26am
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.