Forum Moderators: bakedjake

Message Too Old, No Replies

Rewrite asp to php

Moving asp site to unix server

         

Marshall

4:25 pm on Feb 8, 2015 (gmt 0)

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



I am moving a client of mine from a Windows server to Unix. We do not want to loose the SERP results with the .asp pages, so I would like to know if I can use the .htaccess file to rewrite to have .asp pages treated as .php? I know I cannot run ASP on Unix, I just want to keep the web address. I would rather not do 301 redirects.

Thanks
Marshall

lucy24

9:49 pm on Feb 8, 2015 (gmt 0)

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



I would like to know if I can use the .htaccess file to rewrite to have .asp pages treated as .php

Sure, that's absolutely straightforward. It's a single conditionless RewriteRule. See you in the Apache subforum ;)

Marshall

11:07 pm on Feb 8, 2015 (gmt 0)

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



Hi Lucy and thanks. I have done it before with .html treated as PHP, but I was not sure if the server would freak with .asp. Now all I have to do is re-code everything.

Marshall

lucy24

12:47 am on Feb 9, 2015 (gmt 0)

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



I was not sure if the server would freak with .asp

What the server doesn't know won't hurt it. You could request
example.com/disgusting-ethnic-slur/horrible-vile-obscenity/garbage-text.xtn.html.otherxtn.asp.php.net.zip.tar.gz.htm
and as long as it gets rewritten to
/nicepage.xtn
that's all the server will ever see.

Now all I have to do is re-code everything.

Pah, trivial ;)

Marshall

3:27 am on Feb 9, 2015 (gmt 0)

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



Pah, trivial
Maybe, but I was hoping for a quick and simple move, not something I actually hard to put work into. This one is not billable.

Marshall

lucy24

8:08 am on Feb 9, 2015 (gmt 0)

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



The Regular Expression is your friend. A while back, I translated a bunch of old games from FutureBasic to javascript. An amazing lot of it came down to globally changing the exact syntax of control structures. Here a parenthesis, there a curly brace; here an "else", there an "XELSE". For/Next loops were a particular pain.