1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to parse PHP code on .asp pages (that are on linux server)?

Discussion in 'PHP' started by WyattEA, Oct 15, 2006.

  1. #1
    Hi, I have a site on a linux server, php works fine, but for seo reasons, I still have .asp pages. I have them because I used "AddType text/html asp" to my htaccess file.

    The problem is that the server isn't parsing the PHP code when it sees the page with the .asp extension. Is there a way to tell the server to check all .asp pages for PHP code? I want to add a script to every page on the site so all .asp pages will have the code.

    Thanks,

    James...
     
    WyattEA, Oct 15, 2006 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Try changing the addtype to this:

    AddType application/x-httpd-php .asp
     
    jestep, Oct 15, 2006 IP
  3. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Argh, you're not one of those people who lets search engines dictate how you build your site are you? ;)

    I'll tell you the best solution that I can think of:
    1. Since you're on Linux, and I assume using Apache: use mod_rewrite to make semantic URLs. These have no file extensions, so you avoid running into this kind of issue in the future.
      Use RewriteRule to do this.
    2. So that old links to .asp pages still work, use RedirectMatch to redirect to your new semantic URLs.
    That way, everyone should be happy.
     
    penagate, Oct 15, 2006 IP
  4. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Huh. I've never heard of search engines preferring ASP pages.

    Is this true and if so, what's the reason for it??
     
    TwistMyArm, Oct 16, 2006 IP
  5. Smaaz

    Smaaz Notable Member

    Messages:
    2,425
    Likes Received:
    160
    Best Answers:
    0
    Trophy Points:
    250
    #5
    You could also do a 301 redirect from your asp to the php page with .htaccess
     
    Smaaz, Oct 16, 2006 IP
  6. WyattEA

    WyattEA Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Jestep: I tried that addtype already and instead of displaying the pages on my site, a dialog box popped up and gave me the option of downloading the file.

    Penagate: No, I'm one of those guys who gets bills in the mail and the 6 figure sales from the site help to pay them. So screwing around with ESTABLISHED rankings is what concerns me :)

    I can redirect until my the cows come home, but I'm not willing to do that YET. I have a shopping cart on another site that is PHP and uses modrewrite to avoid the gobbledegook URLS, and I'll be moving this site to that same cart program. I'm not going to start using redirects now just to make the URL extensions .php and then have to use redirects again to get the new url structure.

    TwistMyArm: Search Engines don't prefer .ASP. But my pages that are RANKED already are .asp and as soon as I start playing with changing the filenames OR the file extensions, rankings can go down. Is it a guarantee? Nope, but the bills that show up in my mailbox are so I'm not screwing around with it until I'm comfortable with a potential drop in sales.

    Smaaz: See above why a redirect is not an option at this time.

    The point is, all i want to happen is for php code to execute or be parsed or whatever on my existing ranked .asp pages. I'm surprised it's not an easy fix.

    Thanks for the replies!

    James...
     
    WyattEA, Oct 16, 2006 IP
  7. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well - jestep's solution should work - but it depends on how your hosting is set up.

    If you have Cpanel available, you may be able to do it through the MIME type control panel?
     
    penagate, Oct 16, 2006 IP
  8. Smaaz

    Smaaz Notable Member

    Messages:
    2,425
    Likes Received:
    160
    Best Answers:
    0
    Trophy Points:
    250
    #8
    Missed that!

    You could also try one of these:

    AddType x-mapp-php4 .asp

    Or

    AddType application/x-httpd-php4 .asp
     
    Smaaz, Oct 16, 2006 IP