Jump to content

redirecting category=1 to the real home page


Recommended Posts

Hi all,

 

In the theme I'm using, my "category.php?id_category=1" page looks awful. I'm using an image fader on the home page and it doesn't show in category=1.

 

Anyway, I don't actually want the category=1 (home>home) page to even show, so I'm looking for an easy hack to redirect "category.php?id_category=1" to the actual home page of the site. Maybe by modifying the Home link in the menu?

 

Any help with this greatly appreciated.

Link to comment
Share on other sites

Solved it with a small change to CategoryController.php (PS v1.4.4.1)

 

Inserted the following line between line 94 an 95:

 

if ($id_category == "1") header("Location:
);

 

 

SHOPHOME being the address of my home page. Apologies to any real coders out there if this is bad php, but it appears to do the job :-)

Link to comment
Share on other sites

  • 2 months later...

Never mind I got it! Adding the code right after the following on lines 88[spam-filter] worked for me. :)

if (!($id_category = (int)Tools::getValue('id_category')) OR !Validate::isUnsignedId($id_category))
$this->errors[] = Tools::displayError('Missing category ID');
else
{

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

Here is what i use:

 

.................
  	 else
	{
		if((int)$this->category->id == 1)
		{
			$shopUrl = Tools::getShopDomain(true).__PS_BASE_URI__;
			header('HTTP/1.1 301 Moved Permanently');
			header('Location: '. $shopUrl);
			exit();
		}
.................

Link to comment
Share on other sites

  • 8 months later...

Here is what i use:

 

.................
  	 else
	{
		if((int)$this->category->id == 1)
		{
			$shopUrl = Tools::getShopDomain(true).__PS_BASE_URI__;
			header('HTTP/1.1 301 Moved Permanently');
			header('Location: '. $shopUrl);
			exit();
		}
.................

Where I must put this code? can you say me some line before this?? Edited by MarioDJNaro (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Where I must put this code? can you say me some line before this??

 

 

Here is what i use:

 

.................
  	 else
	{
		if((int)$this->category->id == 1)
		{
			$shopUrl = Tools::getShopDomain(true).__PS_BASE_URI__;
			header('HTTP/1.1 301 Moved Permanently');
			header('Location: '. $shopUrl);
			exit();
		}
.................

Here is what i use:

 

.................
  	 else
	{
		if((int)$this->category->id == 1)
		{
			$shopUrl = Tools::getShopDomain(true).__PS_BASE_URI__;
			header('HTTP/1.1 301 Moved Permanently');
			header('Location: '. $shopUrl);
			exit();
		}
.................

 

please tell us where to insert this code

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...