Forum Moderators: Robert Charlton & goodroi

Message Too Old, No Replies

Nervous: Want to change site from ASP to PHP

         

apauto

12:58 am on Nov 3, 2010 (gmt 0)

10+ Year Member



Hi guys,

I have a site that is all in ASP. I need to change the technology to PHP to update the site and move forward.

However, I have a few problems:

1) How can I 301 the asp pages to php? When the technology moves over to php, the asp pages won't work anymore, so they won't be able to 301.

2) Can the above be done with a 301 redirect using htaccess? For example, the switch would be "straight forward":

widgets.com/blue-widgets.asp
301 redirect to:
widgets.com/blue-widgets.php

(only the extension would change.... this will cure about 90% of the pages on the site).

Thanks in advance guys...

MLHmptn

1:56 am on Nov 3, 2010 (gmt 0)

10+ Year Member



apauto: Read here: [webmasterworld.com ]

It would be best to parse your asp as php if the URL's will be the same before the extension. Also it is a php handler that is built within apache though I think you can do it in .htaccess as well. Consult the mod rewrite forum.

goodroi

10:28 am on Nov 3, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the mod rewrite section here on webmasterworld is a great resource to use.

in general try to avoid using redirects when possible and instead maintain url structure and change the stuff in the backend. if you cant do that then using a htaccess file to 301 redirect is a good alternative.

the reason why i try to avoid redirects is because there is some link evaporation. also you can have trouble if you accidentally create a chain of multiple redirects (which becomes more common after several redesigns). that being said dont forget a 301 redirect is better than a 404 error.

graeme_p

10:58 am on Nov 3, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you do change the urls, this time do not have a technology specific suffix. I now always use urls that end in a slash (e.g. http://example.com/mydir/mypage/ ) as every CMS and framework I have tried will work with that.

For more complex redirects you can write a script to do them. This has the advantage of being able to look up page ids and the like in a database.

setzer

9:43 pm on Nov 3, 2010 (gmt 0)

10+ Year Member



Using rewrites, you can retain the *.asp URLs while switching over to PHP. Personally though I would strip the extensions out from the URL altogether going forward, then keep the old URLs the same.

g1smd

8:29 am on Nov 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would keep the same .asp URLs (while running new PHP scripts) so that both visitors and searchengines alike have no idea that the internals running the site have changed.

At a later date, you could move to extensionless URLs, but there's often a traffic dip while things are getting re-indexed.

indyank

12:06 pm on Nov 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With google facing so many technical glitches, if i were you, i would postpone this move unless the urls are the same before and after the change, without the need for any redirects.

indyank

12:08 pm on Nov 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you are moving to a CMS platform like wordpress, you could still retain "widgets.com/blue-widgets.asp" without any redirects.

milosevic

1:19 pm on Nov 4, 2010 (gmt 0)

10+ Year Member



It would be a mistake to redirect *.asp to *.php

Do what graeme_p says because this is far better for long term SEO, looks better and has no disadvantages other than requiring copying and pasting a couple of rewrite rules into your .htaccess. Otherwise in a couple of years when you switch to a different framework you'll end up in exactly the same situation.

It would be better to keep serving the URLs at *.asp than to redirect to *.php

graeme_p

7:59 am on Nov 15, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you do decide to change the extension (rather than parsing.asp as php), I suggest ending all urls in a slash - almost all CMSs and frameworks will support that with minimal configuration, so it has the lowest odds of needing to be redirected again.