Having problems with .htaccess / mod_rewrite - HELP!

Discussion in 'Apache' started by newline100, Dec 11, 2005.

  1. #1
    Hi,

    I appreciate your help on these boards but I am new to this stuff & having some problems. Let me start with the basics:

    I have successfully used the mod_rewrite by changing:

    http://www.mysite.com/mydirectory/postlist.php?Cat=0&Board=myfile
    to
    http://www.mysite.com/mydirectory/myfile.htm
    by using the following .htaccess code:

    RewriteEngine on
    RewriteBase /mydirectory/
    RewriteRule ^myfile\.htm$ postlist.php?Cat=0&Board=myfile [T=application/x-httpd-php]

    Here is my problem, I have to physically type in the static address to make sure this code works. On my webpage, when I run my mouse pointer over the target link, the dynamic link shows up on the bottom left hand corner of the browser. Furthermore, when I click the link, it still defaults to the old dynamic url.
    Is there extra code to insert that will make the static URL show up in the browser address window? Would I need to go into the PHP file and change the url to the new static version? Is there a way to avoid this as I'm working off of a database and am not sure where that PHP file would be.

    I figured out how to utilize the mod_rewrite function but am getting stuck on this last part. I guess the bottom line is: how do I make the links on my PHP pages display (and then redirect) to the newly formed static URL's?

    If you could please explain all of this very carefully, I would appreciate it. As I stated, I'm new to all of this.
     
    newline100, Dec 11, 2005 IP
  2. piniyini

    piniyini Well-Known Member

    Messages:
    514
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    170
    #2
    The answer to the first part of your question in yes, you would need to change it from the php file.

    To the second part, there is a way to redirect files that are dynamic to static urls but I wouldnt reccommend it. I I were you I would edit the php files and go about it that way.
     
    piniyini, Dec 11, 2005 IP