I currently have User SEO URL's
set to Yes in OpenCart Admin.
System -> Settings -> Store -> Server -> User SEO URL's
So far, all tags and SEO links are working; the command has done the desired effect.
However for the homepage and a few other links; how do I remove:
index.php?route=common/home
From the URL? Do I have to literally do a find and replace in the hardcode PHP files and risk upgrades or is there another way?
(without bloating performance i.e no poor amateur tools such as vQmod)
How about replacing a link in logo with
<?php echo $base; ?>
. It will make a link to base domain and will removeindex.php?route=common/home
.To simply remove that, you can do a basic replace in
/catalog/controller/common/seo_url.php
Find:
Before it on a new line put:
Edit by TheBlackBenzKid: If you want full SEO just use this line instead of the above:
Also make sure SEO URLs is turned on in the Admin panel of the store.
Step 01. Enable USE SEO URL’s in your store server settings
Go to the “System” and click on “Settings”. Locate the store you want to alter and click the “Edit” link on the right. Finally click the “Server” tab and set the SEO URL’s radio to “Yes” and save your settings.
Note: The keywords will not be created for you automatically. You must also have Apache mod_rewrite turned on. Most web hosts will have this on by default. Step 3 of this tutorial will explain how to add the keywords.
Step 02. Change some content in your .htaccess file to make your homepage SEO URL Friendly
Go to your host control panel and edit your .htaccess file. Sometimes this file is hidden in order to unhide it you can click on your web host control panel file manager and tick the show hidden files option followed by the “go” button.
Once you locate the .htaccess file change the following lines:
To:
If you do the step above your home page will change from something like this: http://yourwebsite.com/index.php?route=common/home to this: http://yourwebsite.com
Step 03. Enter SEO Keywords for URL’s manually Finally, you need to enter SEO keywords for every page, information, product and category you want to have URL rewrite. You can find the field for the SEO Keywords under the Data tab when editing and creating items.
Once you have entered the SEO Keywords your URL’s will be working.
Once you have followed all these instructions you can begin to reap the benefits of higher rankings, increased traffic and more customers.
/catalog/controller/common/seo_url.php
Open the file and replace the below code
------------------ WHERE THE CHANGE -------------------------
The below Line i added in Public Function index() also Public Function rewrite.
index() function Perform like this
i got this http://www.antropy.co.uk/index.php/blog/one-quick-opencart-seo-tip-to-avoid-a-duplicate-home-page/ worked for me in removing the code for my homepage
The previous "solutions" are wrong because they are attacking the SEO URL translate. What you want is to deal with the URL generation inside OpenCart.
Let's keep it simple. Go to
/system/library/url.php
and look at thepublic function link
. Replace the function with this version:Simple like that. I can't belive why this is not in OpenCart's core.
EDIT:
I run some tests and if the SEO URLs are enabled, it becomes necessary to make one single edit in the
/catalog/controller/common/seo_url.php
to avoid an "Undefined index" error.Inside
public function rewrite
, replace this line:With this one:
Now it really works.