Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2008
    Posts
    187
    Plugin Contributions
    0

    Default htaccess to redirect all index.php to / ??

    Hey all,

    right i absolutely HATE htaccess files, everything i seem to do to them always breaks the site one way or another.

    im trying to block out /index.php and 301 them to the folder root.

    theres loads of articles on the internet about these but every option i try just blanks out the whole site.

    i already have:

    #adds www
    rewritecond %{http_host} ^website.co.uk
    rewriteRule ^(.*) http://www.website.co.uk/$1 [R=301,L]

    which works fine,

    but every try i have of getting rid of index.php just breaks everytime

    any ideas people?

    Andy.

  2. #2
    Join Date
    Aug 2005
    Location
    United Kingdom
    Posts
    457
    Plugin Contributions
    0

    Default Re: htaccess file issue

    Redirect 301 /index.php http://www.yourdomain.co.uk/page_or_folder

    i have the above diverting mine to another path

    rob

  3. #3
    Join Date
    Jun 2008
    Posts
    187
    Plugin Contributions
    0

    Default Re: htaccess file issue

    nah i know how to do 301 redirects of folders and files. but i want an overall rule that will remove all /index.php from all folders and 301 it to /.

    Andy.

  4. #4

    Default Re: htaccess to redirect all index.php to / ??

    I had the same question, and after doing some research I managed to find the solution!! So I thought I would post it to let everyone know...

    Paste the following code into the htaccess file found in the root directory:

    Code:
    RewriteCond %{THE_REQUEST} ^.*/index\.php
    RewriteRule ^(.*)index\.php$ /$1 [R=301]
    This redirects the www.yourdomain.com/index.php to www.yourdomain.com.

    The reason for doing this is for SEO purposes. The index.php is duplicate content and this will dilute the trust and authority that the search engines will give to you main page.


  5. #5
    Join Date
    Jun 2008
    Posts
    187
    Plugin Contributions
    0

    Default Re: htaccess to redirect all index.php to / ??

    Yep he's bang on, worked like a charm

    many thanks

    Andy.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: htaccess to redirect all index.php to / ??

    This one handles a few additional formats one might encounter: http://www.zen-cart.com/forum/showpo...4&postcount=32
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Please! how to redirect a index.php?option=com?
    By DArnaez in forum General Questions
    Replies: 2
    Last Post: 1 Nov 2014, 03:01 AM
  2. Replies: 4
    Last Post: 9 Apr 2010, 11:17 AM
  3. index.php gives redirect loop error
    By chinaKat in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 12 May 2009, 01:51 AM
  4. admin/index.php all messed up.
    By raquelann in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 16 Jul 2008, 02:43 PM
  5. Replies: 0
    Last Post: 26 Oct 2007, 12:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg