SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Location
    Trondheim, Norway
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RewriteRule problem in .htaccess

    I'm having a little problem in my .htaccess file on a site I'm working on.

    The problem is that the rewrite engine writes the whole URL back to the users browser even if I havent put [R] behind the URL

    Example:
    RewriteRule ^news/([0-9])/$ http://www.mysite.com/?page=news&category=$1

    This adresse:
    http://www.mysite.com/news/4/
    puts the user to:
    http://www.mysite.com/page=news&category=4

    The adress in the browser should remain
    http://www.mysite.com/news/4/
    but it doesn't.

    The rewrite rule above works perfectly on other servers I've tried it on, but on this specific server it rewrites the url in the users browser as well.
    So it has to be something with the server.

    The question is, can I do something about it, or is it something the server administrator has to take care of?

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    RewriteRule ^news/([0-9])/$ script.php?page=news&category=$1

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Md,

    The rule is that the redirection WILL be displayed if the redirect is to an absolute URL OR R=301. cc's solution will work for you.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •