»
S
I
D
E
B
A
R
«
Magento Redirect index.php
December 28th, 2009 by admin

Magento has an annoying problem of have both index.php and root displaying the same home page content. To redirect index.php to the root is easy.

For instance, if you want to redirect a url like http://www.example.com/index.php/ to http://www.example.com/, here is what you can do. in your page template (for example, 2columns-left.phtml) add in the following line at the very top of the file:

<?php
if ( $_SERVER['REQUEST_URI'] == "/index.php/" || $_SERVER['REQUEST_URI'] == "/index.php" ) {
    header( 'Location: http://www.example.com/' ) ;
}
?>
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay



Similar Posts:
One Response  
  • Backlink-Jackpot writes:
    December 28th, 2009 at 6:50 am

    [...] Magento Redirect index.php | Highub [...]

    [WORDPRESS HASHCASH] The comment’s server IP (174.120.106.66) doesn’t match the comment’s URL host IP (174.120.106.92) and so is spam.


Leave a Reply

Powered by WP Hashcash

»  Substance: WordPress   »  Style: Ahren Ahimsa