How to rewrite SEO URL in magento?

Member

by drew , in category: SEO , 2 years ago

How to rewrite SEO URL in magento?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

3 answers

by jaycee_rowe , 2 years ago

@drew 

To rewrite SEO URL in Magento, you can follow these steps:

  1. Log in to the Magento admin panel and navigate to "Stores" > "Configuration" > "Catalog" > "Search Engine Optimization."
  2. Set "Use Web Server Rewrites" to "Yes."
  3. Clear the Magento cache.
  4. Navigate to "Marketing" > "URL Rewrites."
  5. Click the "Add URL Rewrite" button.
  6. Select the "Custom" option and fill in the necessary fields such as Request Path, Target Path, Redirect Type, and Store.
  7. Save the URL rewrite.


By doing this, Magento will use the new SEO-friendly URL that you have created instead of the default URL.

by clarabelle , 10 months ago

@drew 

Here's a step-by-step guide to rewrite SEO URLs in Magento:

  1. Log in to your Magento admin panel.
  2. Navigate to "Stores" > "Configuration" > "Catalog" > "Search Engine Optimization."
  3. Set "Use Web Server Rewrites" to "Yes" to enable the use of SEO-friendly URLs.
  4. Clear the Magento cache by going to "System" > "Cache Management" and clicking on "Flush Magento Cache."
  5. Navigate to "Marketing" > "URL Rewrites."
  6. Click on the "Add URL Rewrite" button to create a new rewrite.
  7. Choose the "Custom" option from the dropdown menu.
  8. Fill in the necessary fields: Request Path: Enter the URL you want to rewrite. For example, if you want to rewrite "example.com/category/product.html" to a more SEO-friendly URL, you would enter "category/product.html" in this field. Target Path: Enter the target URL, which should be the actual path to the product or category. For example, "catalog/product/view/id/123" or "catalog/category/view/id/456." Redirect Type: Choose the appropriate redirect type based on your needs. Generally, a "Permanent (301)" redirect is recommended for SEO purposes. Store: Select the store or leave it as "All Store Views" if you want the rewrite to apply to all stores.
  9. Click on the "Save" button to create the SEO URL rewrite.


By following these steps, you can successfully rewrite SEO URLs in Magento to create more user-friendly and search engine optimized URLs for your store.

Member

by zion , 9 months ago

@drew 

I apologize for the incorrect information in my previous response. To rewrite SEO URLs in Magento, you need to create a rewrite rule in the .htaccess file.


Here are the steps to rewrite SEO URLs in Magento:

  1. Log in to your server using FTP or SSH.
  2. Locate the .htaccess file in the root directory of your Magento installation.
  3. Open the .htaccess file in a text editor.
  4. Search for the section that starts with "#RewriteEngine on" (approximately line 108).
  5. Uncomment the line "RewriteBase /" by removing the "#" symbol in front of it if it is commented out.
  6. Add the following code after the "RewriteBase /" line:
1
RewriteRule ^old-url-path/?$ /new-url-path [R=301,L]


Replace "old-url-path" with the current URL path you want to rewrite, and replace "new-url-path" with the desired SEO-friendly URL path. For example, if you want to rewrite "http://example.com/category/product.html" to "http://example.com/new-category/new-product.html", you will use the following rule:

1
RewriteRule ^category/product.html$ /new-category/new-product.html [R=301,L]


  1. Save the .htaccess file and upload it back to your server, overwriting the existing file if prompted.
  2. Test the rewritten SEO URL by accessing the old URL path in your browser. It should automatically redirect to the new SEO-friendly URL.


Note: Make sure to replace "http" with "https" if your website is using SSL.


Remember to back up your .htaccess file before making any changes, and always test the rewritings on a staging or development site before applying them to a live site.