cannot execute XHTML

Discussion in 'PHP' started by asela_05085, Sep 10, 2009.

  1. #1
    hi,

    recently i was able to disable PHP in some folders by adding below lines in httpd.conf file

    <Directory "/var/www/html/wap/xhtml">
    php_admin_flag engine off
    </Directory>

    now i'm facing new problem.
    when i access .xhtml files in the PHP disabled folders, instead of loading those page, it downloads the page
    so in some browsers i get the error as cannot download this file

    what can i do to avoid this and enable xhtml in those folders

    pls help
     
    asela_05085, Sep 10, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Um why do you use a xhtml extension? Just rename to .html and use the correct doctype to ensure the page is interpreted as xhtml. This has nothing to do with your .htaccess
     
    premiumscripts, Sep 10, 2009 IP
  3. asela_05085

    asela_05085 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes ,i found that once rename those files to .html it works.
    i have written many pages with .xhtml extension so it will take long time to change those files and links within those files to html.
    that's why i need a solution to execute .xhtml files
     
    asela_05085, Sep 10, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Add this to your .htaccess:

    AddType application/xhtml+xml .xhtml
    Code (markup):
     
    premiumscripts, Sep 10, 2009 IP
  5. asela_05085

    asela_05085 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    can you give me a way to find out whether my .htaccess are working fine?
    I'm not sure whether .htaccess is working or not in my server (how to enable)
     
    asela_05085, Sep 10, 2009 IP
  6. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Um yeah, if your PHP isn't working in the directories you specified then it's working fine.. Have you added the line I told you yet?
     
    premiumscripts, Sep 10, 2009 IP
  7. asela_05085

    asela_05085 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    yes but still no luck.here is what i have done,
    created a .htaccess file in the PHP disabled folder and add the below given line in that folder.
    AddType application/xhtml+xml .xhtml
    then after, i restarted the Apache and try those xhtml files in the PHP disabled folder on browser.
    but still what happen is save the xhtml file to my local machine and then open the saved file in the browser
     
    asela_05085, Sep 10, 2009 IP
  8. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Well, if htaccess is disabled you could add that line to your httpd.conf as well.. right where you have the disable php line
     
    premiumscripts, Sep 10, 2009 IP
  9. asela_05085

    asela_05085 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    there is a luck with what you have suggested and now i can load the xhtml files.
    but now it checks for errors in the coding and display only part of the page. if i save the same file as a .html file then no issue.
     
    asela_05085, Sep 10, 2009 IP
  10. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Then change it to AddType text/html .xhtml
     
    premiumscripts, Sep 10, 2009 IP
  11. asela_05085

    asela_05085 Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    thanks premiumscripts. it's now working perfectly. thanks again:):)
     
    asela_05085, Sep 10, 2009 IP