1

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.

2

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.

1

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.