SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mod_rewrite, need help

    I have nexh .htacces file
    Code:
    RewriteEngine On
    RewriteRule ^(.*)\.(php|html)$ index.php?url=$1 [NC,QSA,L]
    and this is working, I can get my $_GET['url']

    Now I have links like www.site.com/page/page/page/index.php and with .htacces
    I have from GET -> page/page/page/index and this is good

    but I need to have in browser same links
    I need to send link to browser permanently
    and it should be:
    Code:
    www.site.com/page/page/page/index.html
    example
    if user request link
    Code:
    www.site.com/page/page/page/something
    or
    Code:
    www.site.com/page/page/page/something.php
    in browser it should get
    Code:
    www.site.com/page/page/page/something.html

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

    It sounds like what you're asking for is the R=301 flag which will change the URL to that to which you redirected.

    BTW, don't you think (.*).php will match your index.php in the redirection. Ah, another case of improper use of the EVERYTHING atom.

    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
  •