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.

Redirect not found pages on same domain with htaccess

July 11, 2013 4:33pm

Subscribe [1]
  • #1 / Jul 11, 2013 4:33pm

    I recently redesigned a site that now uses some different link names. The domain name is still the same it’s just that some pages are not found anymore that show up in search engine results pages. For instance http://www.domainname.com/contact-us is now http://www.domainname.com/contact. Now there are too many pages on the old site to redirect each one so I just want to send any of the page not found links to the home page of the new site.

    The current htaccess code I have is for removing index.php from my urls.
    I tried a bunch of different things but nothing worked and I can’t find anything documented on this. It’s all just moving olddomain.com to newdomain.com.

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php/$1 [L]
            # If 404s, "No Input File" or every URL returns the same thing
            # make it /index.php?/$1 above (add the question mark)
    </IfModule>
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases