Mage is definitely a good platform for ecommerce websites. Even one of the best. But, regarding SEO a few things might need to be fixed. One of them is LocalHost Magento index php in the frontend URL. Even though there is no benefit to having the localhost magento index php in the frontend. On the other hand the URL in frontend is bad for the site structure. On the top of that Google is more friendly to clean URLs. So, lets get start with removing LocalHost Mage index.php from the URL base.
Follow these steps to successfully remove LocalHost Magento index php.
- First go and Login to Mage Admin Panel. Then navigate through “System” tab.
- Next find “Configuration” under “system” tab. On the left side bar find “WEB” under the “General” settings. Then you’ll see the following screen pop up.
- Afterwards under the “Search Engine Optimization(SEO)” tab find “User Web Server Rewrites” option. Next in the drop down list change to “YES” for “UWSR”.
- Then navigate down through the page and find “Use Secure URL in frontend”. Now also change the settings to “Yes” to secure URL in frontend. On the top right press “Save Config.” Button to save current settings.
Next we’ll need a “.htaccess” in our ROOT DIR (in the path Mage installed). However we have to ways to deal with the situation.
Case: 1 First we can create a new “.htaccess” file. Specifically using the same name create a “.htaccess” file. Later we can replace with the original “.htacess” file in the ROOT DIR with new codes. Then upload the “.htacess” file using an FTP (Filezilla, etc.) client. Generally coders use Notepad++ for editing the “.htaccess” file.
OR
Case: 2 Rather we can also use cPanel. Next login your cpanel using your hosting credentials. After logging in navigate through the “File Manager”. Next under the ROOT DIR find “public_html” folder.
- Double click to open the folder. Now find the “.htaccess” file and open the “.htaccsess” file in cpanel Editor. Then replace the following code with the original one. That’s it we’re done!!
Hence, following LocalHost Magento index php codes needs to replace with original.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
In case your Mage is installed under any sub folder such as “my_website” for example. Instead use these following codes. However Paths might vary and every coder can should have the idea to implement the changes.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /shop/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /my_website/index.php [L]
</IfModule>
- Finally for “Case: 1” save the new “.htaccess” file. Next upload the file and replace with the original “.htaccess” in ROOT DIR.
- OR
- If you’re following “Case: 2” press save button in cPanel editor. Finally you’re done.
Now clear cache of your browser and re open your site link in a newly opened tab. Here you can see that LocalHost Magento index php is removed form base URL.
Last but not the least, you just have secured your site while making it SEO friendly.
In conclusion, ask your further queries joining Magento Exchange.
Moreover you can try Aspiration hosting for your Mage site. As our hosting provides full development support with all Mage hosting plans. Just contact to our 24×7 customer support for any issue regarding performance of your site. Our Basic plan begins at $9.99 per month. Though the Pro plan comes with phone support begins at $64.99 per month.
Mehedi Hossain Chowdhury for Aspiration Hosting