How to redirect old "ugly" urls to SEO-friendly ones?

Member

by julio , in category: SEO , 8 months ago

How to redirect old "ugly" urls to SEO-friendly ones?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

by naomi_cronin , 8 months ago

@julio 

To redirect old "ugly" URLs to SEO-friendly ones, you can use server-side redirects. The exact method depends on the web server software you are using. Here are some examples for the most common web servers:

  • Apache: Use a .htaccess file with the following code:
1
2
RewriteEngine On
RewriteRule ^old-ugly-url$ /seo-friendly-url [R=301,L]


  • Nginx: Use the following code in your server block configuration:
1
rewrite ^/old-ugly-url$ /seo-friendly-url permanent;


  • IIS: Use the URL Rewrite module with the following code in your web.config file:
1
2
3
4
<rule name="Redirect to SEO-friendly URL">
  <match url="^old-ugly-url$" />
  <action type="Redirect" url="/seo-friendly-url" />
</rule>


Note: Make sure to replace "old-ugly-url" and "/seo-friendly-url" with your actual URLs. Also, make sure to test your redirects after implementation to ensure they are working correctly.