Jump to content

MAPA3M

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by MAPA3M

  1. This is a tricky one... how do you tell if the request is invalid or is for a user or is for a regular file?

     

    for example... you have a user \"john\".... this would make the request

     

    http://www.blah.com/john

     

    valid from the logical point of view... however, to Apache that request and

     

    http://www.blah.com/no-such-user

    and

    http://www.blah.com/index.html

     

    will look exactly the same... so while I did set up a mod_rewrite that\'ll do what you want, it doesn\'t seem very useful because apache will rewrite EVERY REQUEST that\'s 404 to view.php?user

     

    Best that you can do is something like

     

    http://www.blah.com/~validuser

     

    That way you can either use apache\'s mod_userdir or set up a simple mod_rewrite rule to forward those users

     

    Now, for reference....

    This is the answer to your original question...maybe you can improve on it

    
    RewriteEngine ON
    
    RewriteCond  /your/docroot/%{REQUEST_FILENAME} !-f
    
    RewriteCond  /your/docroot/%{REQUEST_FILENAME} !-d
    
    RewriteRule ^/(.*) /view.php?user=$1
    
    

     

    This is what can forward /~user

    
    RewriteEngine ON                                                                                                    
    
    RewriteRule ^/~(.*) /view.php?user=$1
    
    

     

    Hope this helped!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.