ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Remove index.php from live site and 301 Redirect all pages

October 06, 2010 3:47pm

Subscribe [2]
  • #1 / Oct 06, 2010 3:47pm

    Brad Dyment

    4 posts

    Hi all,

    I’m trying to remove index.php from an EE site that was build about a year ago, so there are 200+ pages that need 301 Redirect’s. I already have the list of 301’s, but for some reason it isn’t playing nicely with my RewriteRule. Here’s what I’ve got in my .htaccess

    # Remove index.php
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]
    
    # 301 Redirect for 200+ pages
    Redirect 301 /index.php/about/ <a href="http://website.com/about/">http://website.com/about/</a>
    Redirect 301 /index.php/services/ <a href="http://website.com/services/">http://website.com/services/</a>
    Redirect 301 /index.php/blog/ <a href="http://website.com/blog/">http://website.com/blog/</a>
    Etc, etc etc…

    And I get:

    The page isn’t redirecting properly
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    Help!! Thanks in advance.

    Cheers,
    Brad

  • #2 / Oct 06, 2010 5:24pm

    Ingmar

    29245 posts

    Unfortunately we don’t officially support server side rewriting like that. Let me move this to the CodeShare corner for you.

  • #3 / Oct 06, 2010 6:17pm

    ender

    1644 posts

    the problem here is that you’re trying to redirect http://website.com/index.php/about/ to http://website.com/about/ and then rewriting that back to http://website.com/index.php/about which redirects to http://website.com/about/ which… you get the point.

    in order to break the chain, you need to rename your index.php file so that you can redirect index.php/about to /about and then rewrite that to whatever.php/about which serves the request.

  • #4 / Feb 23, 2011 8:12pm

    Brad Dyment

    4 posts

    @ender Thank you!! That makes perfect sense… all fixed! Cheers.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases