Treehouse: Grow your CSS skills. Land your dream job.

301 redirects or mod_rewrite extension better for SEO?

  • # November 3, 2011 at 1:47 pm

    I’m transferring an old site to a new design/structure. It was html, now php. So to maintain the SEO and for incoming links which would be a better solution?

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}/$1.php -f
    RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L]

    redirect 301 /index.html
    redirect 301 /about.html

    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*).html$ /$1.php [L,QSA]

    # November 3, 2011 at 2:05 pm

    Definitely will want to use the 301 redirects if you are moving a domain. As for the mod_rewrite stuff, I’m a little out of my element there.

    You’ll also want to set up a domain forwarding from your domain control panel.

    # November 3, 2011 at 2:41 pm

    I think you misunderstood or maybe I did not explain it correct, the domain is staying the same. I’m just switching to an updated design/php structure.

    Basically if all the pages are named the same (they are), and I rewrite the extension to read .html, I won’t need redirects because they all appear as .html pages even though they are actually php pages. (in other words if you click an old link posted somewhere that has the URL “” it will now take you to “”; however what you are really viewing is: “”)

    Otherwise, I can remove the php extension and then use redirects to redirect to the new pages…

    # November 4, 2011 at 6:48 pm

    Anyone have any ideas if one way is better than the other?

    # November 7, 2011 at 1:37 pm

    Aaahhh I see. Well then I’m CERTAINLY out of my element! Sorry!

    # November 7, 2011 at 5:09 pm

    No worries, thanks for trying :)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.