Forum Moderators: phranque

Message Too Old, No Replies

Old URL string to new URL string

Old site upgrade to new CMS system

         

decaff

12:16 am on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi..

I am currently putting together a .HTACCESS file for a project where a well established old site is now being moved (on the same host .. with the same domain name) to a new CMS system...

This well established old site has some very well established link relationships in place (most pointing to the root url...so no problem there)...and some pointing to interior pages (which will be vetted out and request for changes made once the new format is live....)

The old URL naming convention is:
www.domain.com/file-name.html
or
www.domain.com/directory/file-name.html

The new URL naming convention being used with the CMS goes like this:
www.domain.com/file-name/
or
www.domain.com/directory/file-name/

I believe the easiest way to do this (?) then is to set up the HTACCESS File like this:

Redirect file-name.html [domain.com...]

OR

Redirect /directory/file-name.html [domain.com...]

NOTE: This last directive should all be on one line .. no word wrap...

QUESTION:
Do I just use
Redirect

OR

Redirect Permanent

? This is where I am confused...(and that's not to hard a state for me to find myself these days... ;-)

Thanks in advance for any and all help with this....

jdMorgan

12:54 am on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The answer is "neither."

Keep your old URLs, because that is where the major investment in terms of link-building has gone.

Then modify the CMS to output the old-style URLs, and "convert them back" as needed, when called, to access the files in the new directory structure. A bit of mod_rewrite code may help here or there, but you can do most of the work in the script.

You can change the internals (filenames) of your site almost any way imaginable, but that does not mean that your URLs need to change.

If you change all of your URLs, best case is that they will drop out of search results for a few weeks. Worst-case, they might be gone for three to six months -- and I've heard of even worse, in one case, a year...

A word from the inventor of the Web, Sir Tim Berners-Lee: [w3.org...]

Jim

decaff

3:30 am on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you for your feedback .. much appreciated

Unfortunately, this thing is a real mess right now..

I do not control the process...
There is a third party provider who built out the new site design under an "unknown" CMS (as in .. I can't identify it from where I sit)..

The original site is about 9 years old and was built out entirely by the site owner over the years who is a service provider...some great content developed here...very natural listings and link structure across the web...I am afraid because of some mistakes made in the process of redesigning the site and with my strongest recommendations back in late 2006 regarding retaining the full set of URLs because of what I saw for internal link counts and external links...and this semms to have been completely ignored by the design team...he will lose the value built into his current site...

Once I made my recommendations... I was out of the loop...
Got in touch with the site owner recently to see where the process was and discoverd all the problems..

Also..they made what I would call a critical error when developing out this thing..

Built the entire project in a subdomain called "test" (http://test.hiscurrent9yearolddomainname.com )...they didn't take precautions to block all bots from this sub-domain...and needless to say...Google found this and indexed the entire thing....(dub content problems now..?)

Once notified, just this last week...They then put up a robots.txt file in the subdomain folder to block the bots...but the damage is already done...

The root url is the same...so the inbounds there are safe...but there is some great link structure from the web inbound to some of his important interior pages...

So is the URL rewrite (Mod_Rewrite) the best method to perform the URL rewrite from the new format to the old format..?

Man .. what a mess this situation has become....

jdMorgan

1:39 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, that's the problem: People/companies undertake these projects without a bit of research or thought about how the Web works; They continue to see Web sites only as stand-alone "online sales flyers" or similar...

In this case, since the change will be permanent, a 301 redirect using mod_alias or mod_rewrite is the way to go. In order to preserve your working relationship with the client, I urge you to let them know that they may well tank their rankings for quite some time because of the wholesale change-over. If the client is a "known/branded entity," then they may get by on name recognition alone without too much revenue disruption from temporary loss of natural search results.

Any of the following can be used, and there is no particular advantage to any -- Just a matter of coding style, really:


RedirectPermanent /directory/file-name.html http://www.example.com/directory/file-name/
#
Redirect 301 /directory/file-name.html http://www.example.com/directory/file-name/
#
RedirectMatch 301 ^/directory/file-name\.html$ http://www.example.com/directory/file-name/
# -or-
RedirectMatch 301 ^/directory/([^.]+)\.html$ http://www.example.com/directory/$1/
#
RewriteRule ^directory/file-name\.html$ http://www.example.com/directory/file-name/ [R=301,L]
# -or-
RewriteRule^directory/([^.]+)\.html$ http://www.example.com/directory/$1/ [R=301,L]

Do be aware, however, that Redirect and RedirectPermanent use prefix-matching, while RedirectMatch and RewriteRule use regular expressions. In practical terms, this can be used to advantage to redirect multiple pages in different ways, and sometimes there is an efficiency advantage to doing it one way or the other. Use whichever method results in the shortest code. The prefix-matching directives can be used for either exact (one-to-one) redirects or for redirecting "anything that starts with <given-path> followed by <anything>" to "<new-path><value of 'anything' from the original URL>". RedirectMatch and RewriteRule add the flexibility -as shown- to copy over the <anything> part (or even partial or multiple parts) from any position in the original URL to the new one as shown -- The contents matching the "([^.]+)" pattern in the directives above are 'copied' into the new URL as "$1".

Note that the RewriteRules are coded for use in .htaccess. If used in httd.conf, conf.d, or other server-config-level files, then add the leading slash as shown for the mod_alias directives preceding them.

If mod_rewrite is already being used on this site, then I suggest using mod_rewrite for the new redirects as well; Mixing mod_alias and mod_rewrite directives means that you will not be able to strictly control execution order; Each Apache module reads your .htaccess file in turn, executing only the directives it understands. Then the next module does the same. The module execution order is set by the server configuration. So, directives in your config files are not executed strictly in the order that your write them.

Jim

decaff

7:53 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Jim..

Thank you for your very detailed response..

I am now actually dialoguing with the "team" who built out the new site...trying to find a solution for my client that will retain as much market value (link relationships) as possible through this process...

If I do use .HTACCESS (actually I already have the file prepared...and it is a straight shot "old url file name" to "new url" ... one to one relationship..)...
Then I believe that there is some value there...though the site will be taking a hit here..

After just talking with the design team there is no turning back the clock to the old URLs..(from their perspective..)
...as in trying to map out the new structure to the old structure through mod_rewrite

The new navigation structure does offer some distinct advantages over the old structure ... both from the human visitor usability perspective and how the bots will crawl the new structure...so this is a plus for sure..

jdMorgan

7:56 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Again, as long as you are 'on record' (in writing) as having warned the company about at least a temporary loss of ranking, you're OK.

Jim

decaff

9:34 pm on Apr 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Jim..

I have covered my ... well on this end..

decaff