SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2004
    Location
    London, UK
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with a very simple Mod Rewrite script

    Hello,

    I have looked into writing mod rewrite scripts, but it is all baffling. What I need is a simple script where my PHP pages can be viewed by calling HTML extensions.

    Example, if someone views www.mydomain.com/aboutus.html then I want them to see the file www.mydomain.com/aboutus.php .

    As simple as that! I dont know if Mod Rewrite is the one to use, so I am open to suggestions.

  2. #2
    SitePoint Member
    Join Date
    Apr 2004
    Location
    Germany
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello phil81uk,

    if you have access to the httpd.conf file, you could simply add

    AddType application/x-httpd-php .html

    to your server configuration. I think all html-files will then be parsed like php-files on the server.

    --
    Greets,
    Hannes

  3. #3
    SitePoint Member
    Join Date
    Apr 2004
    Location
    London, UK
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately I do not have access to the httpd.conf file

  4. #4
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    RewriteEngine On
    RewriteRule ^(.+)\.html$ /$1\.php [L]


    so:
    example.com/pippo.html will call internally pippo.php
    example.com/path/to/aboutus.html will call internally example.com/path/to/aboutus.php

    Is that what you wanted ?


    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •