SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I'm transfering a copy of my site into php, and using Dreamweavers nifty replace function to change the extensions etc.

    What I need to do now is change all the internal links from
    .html and .htm to .php

    What I need to do this and avoid also changing external links is a regex match.

    All my interanal links are absolute or relative so what I need is something which will change:

    I need something which will match something like this
    href="../folder/file.htm"
    or
    href="/folder/file.htm"
    or
    href="../folder/file.html"

    but not this
    http="http://...........htm"

    and then change just change every extension to .php while retaining the /folder/file that precedes it.

    I f anyone can help me out with this I'd be really grateful - I'm not confident enough to play with this as I could mess up 100's of files, if I don't get it correct.


    Thanks for the help in advance








  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would actually use Dreamweaver to do this.

    First make a backup of the entire site.

    Open one page then hit Ctrl + F or select Find and Replace from the edit window

    Find In: entire local site

    Search For: text(advanced) .htm

    Inside Tag a

    Click the + button

    Not containing text http://

    Replace with .php


    Do that for each of the extensions you want to change

    Let me know if you need clarification on any of those steps.
    The basically foolow the order that it shows in the dialog boxes.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers Freddie - I hadn't thought of doing it that way - I only found use for the replace function today (very useful it is to). I'll have a go tommorow, I'm of out for the evening (UK time!)

    Thanks one again!


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
  •