I've searched the site and read a number of topics about it, but none of them actually answer the question. They only state the one by one solution of editing each place the $home variable is with a URL, or provide a sketchy mod that won't last on compatibility.
Does anyone know where I can edit the $home variable to make the change overall?
Thanks.
Hello Icebox,
$home is used in .tpl files and seems to be defined in controllers all over the place. The only way to easily address it globally is with a redirect in your .htaccess file which will catch ALL instances of the standard Opencart home link: /index.php?route=common/home
In the above example /index.php?route=common/home
would be redirected to http://example.com
I did just this and it works like a charm. Hope this helps.
$home is used in .tpl files and seems to be defined in controllers all over the place. The only way to easily address it globally is with a redirect in your .htaccess file which will catch ALL instances of the standard Opencart home link: /index.php?route=common/home
Code: Select all
RewriteEngine On
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://example.com? [R=301,L]
would be redirected to http://example.com
I did just this and it works like a charm. Hope this helps.
Upon revisiting this I realized that my answer does not in fact truly address redefined the home link globally. Over the last month or so I've developed a fix for this though which involves a slight mod to the url library file. This effectively changes everything, everywhere, even breadcrumbs and such. I'll credit Victor Schröder with the base of this code since it came from his post here (http://stackoverflow.com/questions/1081 ... m-opencart) I'm pasting vQmod code below:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>rewrite home url</id>
<version>1</version>
<vqmver>2.3.2</vqmver>
<author>billynoah@zuma-design.com, Victor Schröder</author>
<file name="system/library/url.php">
<operation>
<search position="before"><![CDATA[$url .= 'index.php?route=' . $route;]]></search>
<add><![CDATA[
if ('common/home' == $route) {
if ($args) {
$url .= '?' . str_replace('&', '&', '&' . ltrim($args, '&'));
}
} else {
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[foreach ($this->rewrite as $rewrite) {]]></search>
<add><![CDATA[
}
]]></add>
</operation>
</file>
<file name="catalog/controller/common/seo_url.php">
<operation>
<search position="replace"><![CDATA[parse_str($url_info['query'], $data);]]></search>
<add>
<![CDATA[if (isset($url_info['query'])) parse_str($url_info['query'], $data);
]]></add>
</operation>
</file>
</modification>
http://www.marketinsg.com/clean-seo-url will do the trick, with even more functions
Who is online
Users browsing this forum: No registered users and 114 guests