: URL Rewrite with spaces or with -? Which URL is more SEO? mydomain.com/category-name/article-name.html OR mydomain.com/category name/article name.html I have read some articles about URL Rewriting
Which URL is more SEO?
mydomain.com/category-name/article-name.html
OR
mydomain.com/category name/article name.html
I have read some articles about URL Rewriting but there I can't find any conclusion.
More posts by @Gail5422790
2 Comments
Sorted by latest first Latest Oldest Best
It's not about SEO - using spaces (or other unsafe characters) in a URL is bad practise full stop. The original reason given for this was....
Characters can be unsafe for a number of reasons. The space
character is unsafe because significant spaces may disappear and
insignificant spaces may be introduced when URLs are transcribed or
typeset or subjected to the treatment of word-processing programs.
www.ietf.org/rfc/rfc1738.txt
Although most browsers will now parse them fine, unsafe characters should never really be used in any filename at all. You can't guarantee that a server will encode them correctly and there is no benefit over a hyphen.
Replace spaces with hyphens in URL's without a doubt.
They are more readable otherwise URL's will be encoded in the browser like:-
example.com/category%20name/article%20name.html
It's more friendly for search engines and humans like:-
example.com/category-name/article-name.html
You can accomplish replacing spaces with hyphens by using the php function str_replace like so:-
str_replace(' ', '-', $string);
It would be best practice to implement this in the files that generate the URL's with the above php function rather than to hash a series or RewriteCond's and RewriteRule's in .htaccess to replace spaces with hyphens just to be clear.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.