Hi,
I would like to rewrite the special chars from my old URL
Remove “:” char and replace all accents chars with non accents chars : “é” => “e” …
Exemple :
Old link from my old blog: Mail relay test : Testez la sécurité de votre serveur de mail
New link on Ghost :
Is it possible to integrate JS function in the rewrite.json file ?
Should I modify the Ghost core for that ?
Maybe using NGINX ?
Thank-you in advance,
This is how I would fix it.
- Export you ghost.db
- Open ghost.db it in a IDE like VS Code
- find and replace your links
- re-import your ghost.db in Ghost
Done!
1 Like
I would like to keep inbound links … 
The issue is that my links are rejected by the isSlug control :
validator.extend('isSlug', function isSlug(str) {
return validator.matches(str, /^[a-z0-9\-_]+$/);
});
I think I found the right place in the uncapitalise.js code. I added the following lines
if (/[!:_éèàùç]/.test(decodedURI)){
var newPath = decodedURI.replace(/\s/g, '-')
.replace(/[!:_]/g, '')
.replace(/[é]/g, 'e')
.replace(/[è]/g, 'e')
.replace(/[à]/g, 'a')
.replace(/[ù]/g, 'u')
.replace(/[ç]/g, 'c')
.replace(/[-]{2}/g, '-');
redirectPath = (localUtils.removeOpenRedirectFromUrl((req.originalUrl || req.url).replace(pathToTest, newPath)));
return urlService.utils.redirect301(res, redirectPath);
}
next();
Thank-you !
system
Closed
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.