Aliante Search Engine Optimization | Internet Marketing Blog | SEO Web Design

phone - call us

Page to Page 301 Redirect

The page to page redirect in .htaccess should only be used for pages within a website such as oldpage.html to newpage.html. Or oldpage.php to newpage.html.

301 redirect: Redirect 301 /seo.php

However, if you are getting a forward slash at the end of your “newpage.html/” then you may want to use the Sub-directory to Html rewrite rule instead.

Sub-directory to a HTML Page

To do a permanent redirect from a sub-directory to a HTML page such as to you should do the following:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^ /seo.html [R=301,L]

In addition, if you are getting dynamic URLs at the end of your redirect for example newpage.php?id=section1 then this would likely be a code-order problem, where the internal rewrite of the static URL to dynamic URL is occurring before the external redirect.

In order to control the order of execution you will need to adjust the mod_rewrite version of the redirect, and place the redirect ahead of the internal rewrite. Further, you’ll want to clear any query string received with the client request:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^ /newpage.php[b]l?[/b] [R=301,L]

Tagged with: