Strange Characters added in my URL
-
Hello,
I have been this plugin for a few years, but this thing only happened for 1 URL, although my slug does not contain such characters, these characters %e2%80%a8/ appear in the URL and in google results.Any suggestions how I could fix this?
If I look at the yoast seo snippet below the article all is fine, those characters are not there, and they are not there, and yet thats how my URL has been published.
Any idea what could be the cause?
-
It’s U+2028 – line separator. It’s probably invisible in title and WP automatically encoded it in UTF-8. It isn’t Yoast SEO issue. You should check the title (or even manually retype it) and change permalink.
The title looks clean, the URL looks clean.
This characters are only showing on google but on my backend all looks clean.If I go ahead and retype manually the URL (which already looks clean), then should I create a 301 redirect from the weird one to the new?
Does this also happen when Yoast SEO is deactivated? That’s a quick way to determine if it’s the cause.
Yoast SEO provides a way to edit the slug directly. Once created from the title, it will not be taken from the title anymore, so check the slug itself.
To be sure, highlight everything in the field and type in only what you want to see. Then, save the change and update the post.
I have been a webmaster for many many years. I have posted probably 1000+ posts in my career. I know how to write a slug and this never happened to me, only in this 1 post.
If I just go ahead and edit the slug re-writing it manually, this will not create a redirect automatically right? I have to create a new post, copy paste the content from the weird URL post into the new one and set canonical URL at the bottom of the weird post to redirect it to the good one?
WP core stores old slug as meta key _wp_old_slug. It’s possible that the redirect will automatically work if you only rename it. I’m afraid that could be more complex because it’s “special character”. I’ll try to test it tonight/tomorrow (how it works with these Unicode characters).
I don’t think that you need to set canonical URL because it’s automatic process and 301 redirect should be enough. Maybe rewrite rule in .htaccess should be more efficient way, but I need some time to check all details.
Your issue is related to WP core tickets 47912 and 48475. Basically, it isn’t Yoast SEO issue.
@deon-b Nobody is trying to offend you here. We’re trying to help, which means we can’t assume anything. Even experienced people miss invisible characters sometimes.
Personally, I use the Redirection plugin, which automatically adds redirections for changed URLs. If your page is very new, and there are no links to it yet, nothing will be lost by simply changing the slug.
However, for completeness’ sake, whenever you change a slug, it’s a good idea to redirect the old one to the new one if it’s not automatically redirected by WordPress.
Hey @stodorovic
do you know how I can set all my paginated content to no-index?Yoast team is probably going thru menopause and had the genius idea to remove no-index for pagination a while ago and that negatively affected my rankings. I know maybe some yoast employee now will come up and link to a blog post where they explain why they did this, still this does not change the result that my rankings were negatively affected because of the 100 /page/2/ page/32/ thin pages created thanks to their retarded developers.
Could you please tell me how to
1) No-index these paginated pages /page/3/ page/5/
2) how to tell google bot to de-index these pages?- This reply was modified 4 years, 11 months ago by Deon.
Basically, it’s only issue with pages which could be paginated. Especially when you set static page but you had “latest posts” as the frontpage.
I’ve prepared merged .htaccess file with all “fixes”:
Options -Indexes # Custom 404 error response ErrorDocument 404 /index.php?error=404 # Only allow these extensions <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-includes/js/tinymce/wp-tinymce.php$ - [L] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^wp-(content|includes)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|ico|css|js|swf|xml|xsl|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|gz|zip|rar|pdf|xps|7z|[ot]tf|eot|woff2?|svg|od[tsp]|flv|mov)$ - [L] RewriteRule ^wp-(content|includes|admin/includes)/ - [R=404,L] </IfModule> # Block access to backup and source files. # These files may be left by some text editors and can pose a great security # danger when anyone has access to them. <FilesMatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$"> Order allow,deny Deny from all Satisfy All </FilesMatch> # BEGIN My custom redirects <IfModule mod_rewrite.c> RewriteRule ^my-permalink\xe2\x80\xa8$ my-permalink [R=301,L] RewriteRule ^page/\d+$ / [R=301,L] </IfModule> # END My custom redirects
My advice is to leave subpages for archives (as indexed), but you should add redirects for the frontpage (is isn’t paginated more). In opposite case, it’s possible that googlebot will not refresh older posts. Other options is to set ‘noindex’ for entire archive (eg. I often do it for post tags).
You can try to put new redirects into .htaccess. It’s more efficient way than redirect plugins, but any mistake there could have side effects. So, please test everything after each change in .htaccess. I didn’t fully test previous code, but you should see regular WP 404 error (instead of Apache) for directories in wp-content.
If you want to set noindex for archives then I’ll try to find somewhere my old PHP snippets. I don’t recommend redirects for subpages of archives (maybe you can make redirect loops and more negative impacts).
Anyway, please create new issue related to “subpages” (I’ll easier for me to follow it). Maybe you can close this and previous issues.
Ok thanks a lot. I will reply to you in the other thread.
https://www.ads-software.com/support/topic/how-no-index-paginated-301-redirect-to-home-page/Actually my other thread was blocked could you please reply here:
1) about the unicode characters issue, yesterday I just changed the slug in wordpress and it seems it redirects now. Do you think I should also add this code?
2) this code that you gave me, what does it do exactly, could you please explain it?
3) if I set 301 in htaccess:
/page/2/ to home page
etc.will that work to get these sub-pages de-indexed?
Hmm.. it seems that you didn’t properly escape the code and now this message is marked somehow and moderators should review it. I’ve received some notification at “slack”. I’m checking your initial message.
First block of rules will “filter” all requests and send 404 error instead of 403 for directories (plus filtering all files in “wp-content” to prevent hacking attempts).
Second block will prevent access to wp-config.php, php.ini, error logs, … It’s good way to you little increase security. These files should be accessable only via FTP or CPanel.
Third block is related to this topic. You can put custom redirects here. I’ll explain line by line:
- Line
RewriteRule ^my-permalink\xe2\x80\xa8$ my-permalink [R=301,L]
will redirect URL with encoded end (%e2%80%a8, but RewriteRule should contains de-coded character) to clean URL (replace my-permalink on both places with your URL). Please note space between left part, right part and[R=301,L]
. - Line
RewriteRule ^page/\d+$ / [R=301,L]
use regular expression (\d+) which matches any number, so you don’t need to set 1000 rules. This line will redirect all page/NNNN to home page.
It’s better to add this rule because next change of this permalink will overwrite current value in _wp_old_slug.
- The topic ‘Strange Characters added in my URL’ is closed to new replies.