1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Mode Rewrite to manage site versions

Discussion in 'PHP' started by hasheru, Apr 10, 2010.

  1. hasheru

    hasheru Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #21
    Yess!! Thank you very very much, this helped me out. This did the trick:)

    only a little thing, how can I edit this so it can also be used for later version like version/2010.04.13.1, version/2010.04.15.1, version/2010.04.15.2 etc.. ? I think that's not so heavy but I have no idea of mod_rewrite and htaccess.
     
    hasheru, Apr 12, 2010 IP
  2. nimonogi

    nimonogi Active Member

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    80
    #22
    
    RewriteEngine On
    Options +FollowSymLinks
    
    DirectoryIndex index.php
    
    RewriteCond %{REQUEST_URI} !^/version/2010.04.16.1/
    RewriteCond %{REQUEST_URI} !^/version/2010.04.15.1/
    RewriteCond %{REQUEST_URI} !^/version/2010.04.14.1/
    RewriteCond %{REQUEST_URI} !^/version/2010.04.13.1/
    RewriteCond %{REQUEST_URI} !^/version/2010.04.12.1/
    RewriteCond %{REQUEST_URI} !^/version/2010.04.11.1/
    RewriteRule ^(.*)$ /version/2010.04.11.1/$1  [L]
    
    Code (markup):
    You can add as many rewrite conditions you want, but i recommend to remove them once are no longer necessary.
     
    nimonogi, Apr 12, 2010 IP
  3. hasheru

    hasheru Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Aah, okey thank you alot, but is it possible to do it with regular expressions? Something like this

    
    RewriteEngine On
    Options +FollowSymLinks
    
    DirectoryIndex index.php
    
    RewriteCond %{REQUEST_URI} !^/version/(0-9+\.0-9+\.0-9+\.0-9)/
    RewriteCond %{REQUEST_URI} !^/version/2010.04.11.1/
    RewriteRule ^(.*)$ /version/2010.04.11.1/$1  [L]
    
    Code (markup):
    I tried like this but it didn't help.

    What is this code doing actually?

    Is it looking whether it the url isn't /version/2010.04.11.1/ and rewrite's the url like the given path?
     
    hasheru, Apr 12, 2010 IP