{"id":476,"date":"2019-07-01T09:10:10","date_gmt":"2019-07-01T09:10:10","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/07\/01\/remove-index-php-from-url-in-magento\/"},"modified":"2025-05-22T16:29:44","modified_gmt":"2025-05-22T10:59:44","slug":"remove-index-php-from-url-in-magento","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/remove-index-php-from-url-in-magento\/","title":{"rendered":"How to Remove Index.php from URL in Magento"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">From the below two URLs, which one would you consider more readable, SEO-friendly and user-friendly?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>http:\/\/meetanshi.com\/index.php\/magento-extension<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>OR<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>http:\/\/meetanshi.com\/magento-extension<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Shorter, the better. Isn\u2019t it?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">According to&nbsp;<a href=\"https:\/\/developers.google.com\/search\/docs\/crawling-indexing\/url-structure\" target=\"_blank\" rel=\"noreferrer noopener\">Google<\/a>, the site\u2019s URL structure should be as simple as possible. Additionally, the URLs with a structured hierarchy are preferred by GoogleBot as it makes the crawling throughout the site easier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, the default Magento and Magento 2 offers URLs with a lingering \u201cindex.php\u201d and it is recommended to remove it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Other benefits of short and simple URLs are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Affects CTR. Users may examine the URL to decide whether to click or not.<\/li>\n\n\n\n<li>Improved anchor text link juice flow<\/li>\n\n\n\n<li>A minor ranking factor<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Magento surely is the best platform for E-commerce stores but for the SEOs like me, the pesty index.php can be a nightmare!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, here\u2019s the method to&nbsp;remove index.php from URL in Magento!&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get simple and short URLs without index.php with these easy steps:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:&nbsp;<\/strong>This method only works if&nbsp;<strong>mod_rewrite<\/strong>&nbsp;is enabled. The configuration for Magento 2 is in accordance with the&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-3-release\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2.3.0<\/a>&nbsp;version.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Remove Index.php from URL in Magento:<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">For Magento 2:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. <strong>Log in<\/strong>&nbsp;to Admin panel<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Navigate to&nbsp;<strong>Stores &gt; Configuration &gt; General &gt; Web<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Expand the&nbsp;<strong>Search Engine Optimization<\/strong>&nbsp;section<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Set \u201cyes\u201d to&nbsp;<strong>Use Web Server Rewrites<\/strong>&nbsp;option.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/06\/1_enable-use-web-server-rewrite-1024x439.png\" alt=\"Web Server Rewrites option in Magento store configuration\" class=\"wp-image-5826\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5. Further, expand the&nbsp;<strong>Base URLs (Secure)<\/strong>&nbsp;section<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Set \u201cyes\u201d to&nbsp;<strong><strong>Use Secure URLs on Storefront<\/strong><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/06\/3_M2-secure-frontend-urls-1024x586.png\" alt=\"Use Secure URLs on Storefront option in Magento store configuration\" class=\"wp-image-5827\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">7. <strong>Save<\/strong>&nbsp;the configuration<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">For Magento 1,<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. <strong>Log in<\/strong>&nbsp;to Admin Panel<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Navigate to&nbsp;<strong>System &gt; Configuration &gt; General &gt; Web<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Expand the&nbsp;<strong>Search Engines Optimization<\/strong>&nbsp;section<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Set \u201cyes\u201d to&nbsp;<strong>Use Web Server Rewrites<\/strong>&nbsp;option.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. Expand the&nbsp;<strong>Secure<\/strong>&nbsp;tab<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Set \u201cyes\u201d to&nbsp;<strong><strong>Use Secure URLs in Frontend<\/strong><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/06\/2_Magento-1_remove-index.php_-1024x453.png\" alt=\"2_Magento 1_remove index.php\" class=\"wp-image-5828\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Follow the above steps for your Magento version.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: If you still have an issue in removing the index.php,&nbsp;use a .htaccess File to Rewrite the URLs<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a .htaccess file in the Magento installation folder to compliment the configuration within your admin panel, and this will actually rewrite the URLs. Choose the applicable .htaccess version below.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If your Magento store is installed in root (public_html), use this:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RewriteEngine On\nRewriteBase \/\nRewriteRule ^index.php$ - [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . \/index.php [L]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>If your Magento store is installed in a subfolder (public_html\/shop), use this:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">RewriteEngine On\nRewriteBase \/shop\/\nRewriteRule ^index.php$ - [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . \/shop\/index.php [L]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For the&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-url-rewrite\/\" target=\"_blank\" rel=\"noreferrer noopener\">programmatic method of URL Rewrite in Magento 2<\/a>, check our blog post.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hope it helps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From the below two URLs, which one would you consider more readable, SEO-friendly and user-friendly? http:\/\/meetanshi.com\/index.php\/magento-extension OR http:\/\/meetanshi.com\/magento-extension Shorter, the better. Isn\u2019t it? According to&nbsp;Google,&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-476","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=476"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/476\/revisions"}],"predecessor-version":[{"id":15362,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/476\/revisions\/15362"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}