What Does the Issue Mean?
The “space in URL” error in an SEO audit refers to the presence of whitespace characters within a web address. Hyperlinks should not contain gaps; instead, they should use specific encoding to represent empty characters. Here are some key points about this error:
1. Improper URL Formatting
URLs should not have actual spaces. For example, a link like http://example.com/my page is incorrect.
Blanks in web addresses should be replaced with %20 (URL encoding) or hyphens for readability and SEO purposes. The correct format would be http://example.com/my%20page or http://example.com/my-page.
2. SEO Impact
URLs with spaces are not search engine friendly. Search engines may have difficulty indexing such addresses, which can negatively impact the website’s ranking.
Empty characters can cause issues with URL parsing and lead to broken links, reducing the user experience.
3. Technical Considerations
Web servers and browsers often handle spaces differently. While some browsers might replace blanks with %20, others might not, leading to inconsistencies.
Empty characters in URLs can cause problems with web applications, scripts, and databases that rely on precise hyperlink structures.
What Triggers This Issue?
The “space in URL” issue can be triggered by several factors, often stemming from manual errors or misconfigurations. Here are some common triggers:
1. Manual URL Entry Errors
When manually creating or editing URLs within a CMS, users might accidentally include gaps. Hand-coded HTML pages might have web addresses with spaces due to oversight.
2. Improper Filename Handling
When files (like images or documents) are uploaded with spaces in their filenames, the URLs generated might include those empty characters.
Some servers do not automatically handle spaces in filenames, leading to URLs that directly reflect the filenames.
3. Dynamic URL Generation Issues
Scripts that dynamically generate web addresses might not properly encode spaces, resulting in malformed URLs.
When parameters are passed in links, gaps within parameter values might not be correctly encoded.
4. Linking Practices
Spaces might be inadvertently included when creating internal links, especially if copying and pasting text.
External websites linking to your site might include empty characters in addresses, especially if they manually input the URLs.
5. Migration and Import Errors
Existing URLs with spaces might be carried over without correction during website migrations or content imports.
Importing data from external sources might include addresses with empty characters, leading to issues if not sanitized.
6. User-Generated Content
Users might include URLs with spaces in forum posts, comments, or other user-generated content.
If users can create profiles with custom hyperlinks, they might include blanks.
7. Configuration Issues
Some server configurations might not handle spaces in addresses correctly, leading to accessibility issues.
Misconfigured settings in your CMS or web platform might not enforce proper URL formats.
How to Check the Issue
You can use various tools or test methods to check for whitespaces in strings or URLs — for example, RegEx. However, this requires coding skills since you’ll have to generate a working function or code to detect whitespace. These methods can check for characters like spaces, tabs, form feeds, and carriage returns.
For checking whitespaces in actual URLs, you can simply observe if there are characters in the path. Whitespace can be represented by + and %20 (not 20%.)
To make this process easier, use additional tools. Sitechecker can scan your website and detect all pages with whitespaces in URL.
You will be presented with all impacted pages just by clicking the issue.
Ensure crisp, clear URLs!
Think you might have whitespace characters in your link? Check it with our tool!
How to Fix the Issue
To fix the “space in URL” issue, you can take several steps to ensure that addresses on your website are properly formatted and free of blanks. Here are the steps to address this issue comprehensively:
1. Replace Spaces in URLs
Manually edit URLs within your CMS or codebase to replace spaces with hyphens (-) or underscores (_). Hyphens are preferred for SEO.
Use bulk editing tools or plugins available in your CMS to quickly find and replace empty characters in URLs across multiple pages.
2. URL Encoding
Ensure your server or CMS automatically encodes spaces as %20. This is particularly useful for dynamically generated URLs or query parameters.
Update any scripts or applications that generate URLs to properly encode empty characters.
3. File Naming Conventions
Implement checks before file uploads to ensure filenames do not contain spaces. Use scripts or CMS plugins to automatically rename uploaded files by replacing blanks with hyphens or underscores.
4. Update Internal Links
Update all internal links to use the new, properly formatted addresses without spaces. Use link checking tools to ensure all internal links are updated and do not point to URLs with empty characters.
5. Set Up Redirects
Set up 301 redirects from the old addresses with spaces to the new URLs. This helps preserve SEO equity and ensures users and search engines are directed to the correct URLs. Use redirect management plugins available in your CMS to easily set up and manage redirects.
6. Configure Server Settings
Adjust your server settings to handle web addresses correctly. This might involve setting up URL rewriting rules in .htaccess for Apache servers or using URL rewrite modules for Nginx.
7. Educate Content Creators
Provide training for content creators on proper URL formatting practices. Create and distribute guidelines on how to create and manage addresses without spaces.
8. Regular Audits and Monitoring
Conduct regular SEO audits to catch and fix any new URLs with spaces. Use monitoring tools to get alerts on any new issues related to link formatting.
Example of Fixing a URL
Original URL:
http://example.com/my page
Preferred Formats
1. Using Hyphens
http://example.com/my-page
2. Using URL Encoding
http://example.com/my%20page