.htaccess / pretty urls / mod_rewrite problem?

Discussion in 'PHP' started by PoPSiCLe, Apr 18, 2009.

  1. #1
    I have played around a bit to manage pretty-urls on my page, but I've seem to hit some kind of snag - which I can't seem to google my way out of.

    I have a rule in .htaccess like this:
    
    Options +FollowSymlinks
    RewriteEngine On
    RewriteRule ^magic http://www.mydomain.com/forum/viewforum.php?f=22
    RewriteRule ^([a-z]+)$ /$1/ [R]
    RewriteRule ^([a-z]+)/$ http://www.mydomain.com/index.php?page=$1
    
    PHP:
    This works just fine - if I write something like: http://www.mydomain.com/about it correctly redirects to http://www.mydomain.com/index.php?page=about

    The problem is, I would like to keep the http://www.mydomain.com/about url in the browsers address bar - as it is now it shows the index.php?page=about instead - I thought the rewrite-rule would change this? Am I doing something wrong, or have I forgotten something?
     
    PoPSiCLe, Apr 18, 2009 IP
  2. nayes84

    nayes84 Member

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #2
    try removing the domain name and just keep the page
    example:
     
    nayes84, Apr 19, 2009 IP
    PoPSiCLe likes this.
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    Thanks! Stupid mistake, but once you've started staring yourself blind on your own code... +rep added :)
     
    PoPSiCLe, Apr 19, 2009 IP