mod_rewrite help

Discussion in 'PHP' started by sam1, Jan 6, 2007.

  1. #1
    I have some .php files but i want them to be accessible via .html

    like if have dp1.php dp2.php dp3.php .. and so on
    then i want them to be accessible via dp1.html dp2.html and so on..

    I know that it require some thing related to mod_rewrite??
    But dont know what actually i have to do... any help??
     
    sam1, Jan 6, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    AddType x-httpd-php .php .html .htm
    
    Code (markup):
     
    nico_swd, Jan 6, 2007 IP
  3. sam1

    sam1 Active Member

    Messages:
    679
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks a lot nico_swd. I will try that. Again the system is not allowing me to give u green.
     
    sam1, Jan 6, 2007 IP
  4. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That will just make html pages be served as if they were .php extension. A request for dp1.html will still be 404 unless that dp1.html page actually exists, rather than reading from dp1.php. You'd need to rename all your .php pages to .html.

    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule (.*)\.html $1.php [NC]
    Code (markup):
    Something like that in a .htaccess file might be what you're looking for.
     
    rodney88, Jan 6, 2007 IP