Web Design and Web Development Forum

  1. #1
    Join Date
    Sep 2006
    Posts
    140
    Rep Power
    6
  2. Adamwts is on a distinguished road
  3. .htaccess Virtual Directory

    Well, im trying to get user profiles to be in a virtual directory e.g:
    http://mydomain.com/profiles.php?user=test and i want to get it to display something like http://mydomain.com/users/test, could someone please post me the EXACT full .htaccess file for that example please?
    Thanks ;)
    Reply With Quote Reply With Quote
  4. #2
    Join Date
    Mar 2006
    Location
    Toronto, Ontario
    Posts
    2,270
    Rep Power
    9
  5. Nick Presta is on a distinguished road
  6. Re: .htaccess Virtual Directory

    Reply With Quote Reply With Quote
  7. #3
    Join Date
    Oct 2006
    Location
    United Kingdom
    Age
    20
    Posts
    297
    Rep Power
    6
  8. <? Ashley ?> is on a distinguished road
  9. Re: .htaccess Virtual Directory

    This should work:

    Code:
    RewriteRule /users/(abcdefghijklmnopqrstuvwxyz[0-9]+)
    /profiles.php?user=$1
    Hope that helps.....I know the mod_rewrite syntax can be confusing at first...

    Just remember to READ and try to understand it.....rarther than copying/pasting it into your .htaccess and not learning anything! :P

    Ashley
    Reply With Quote Reply With Quote
  10. #4
    unclekyky's Avatar
    Join Date
    Sep 2004
    Age
    22
    Posts
    5,184
    Rep Power
    13
  11. unclekyky is on a distinguished road
  12. Re: .htaccess Virtual Directory

    Quote <? Ashley ?> originally posted: View Post
    This should work:

    Code:
    RewriteRule /users/(abcdefghijklmnopqrstuvwxyz[0-9]+)
    /profiles.php?user=$1
    Hope that helps.....I know the mod_rewrite syntax can be confusing at first...

    Just remember to READ and try to understand it.....rarther than copying/pasting it into your .htaccess and not learning anything! :P

    Ashley
    Your kidding right? Why write the whole alphabet out, just do "a-z"

    Code:
    RewriteEngine on
    RewriteRule ^users/([a-z0-9]+) /profiles.php?user=$1 [QSA,L]
    I'm not 100% sure that will work. I haven't messed with mod_rewrite in quite awhile.
    Spore-Game - The Ultimate Spore Fan-Site
    Abnegating Avunculicide Since 1601 | YC Wiki - "Quidquid latine dictum sit, altum sonatur."
    Reply With Quote Reply With Quote
  13. #5
    Join Date
    Oct 2006
    Location
    United Kingdom
    Age
    20
    Posts
    297
    Rep Power
    6
  14. <? Ashley ?> is on a distinguished road
  15. Re: .htaccess Virtual Directory

    lol I know...

    I knew I could write a-z, but i didnt know the exact way...."a-z0-9" or "a-z,0-9" ect... :P
    Reply With Quote Reply With Quote
  16. #6
    cancer10's Avatar
    Join Date
    Jun 2005
    Location
    India
    Age
    29
    Posts
    498
    Rep Power
    7
  17. cancer10 is on a distinguished road
  18. Reply With Quote Reply With Quote
  19. #7
    cpf's Avatar
    Join Date
    Jun 2005
    Location
    Box 12 Site 5 RR1
    Posts
    2,829
    Rep Power
    9
  20. cpf is on a distinguished road
  21. Re: .htaccess Virtual Directory

    Uhh,
    a) Old thread,
    b)You need to create the subdomain with whatever (cPanel, etc...), the have that go to, say, a folder called /subdomains/whatever, but use ,htaccess to rewrite any requests in the /subdomains dir to profiles.php?whatever.

    Might post some code when I get home :p

    Quote Calamitie originally posted:
    Calamitie says:
    Noodles is a lossy teleportation framework for Noodle objects
    Reply With Quote Reply With Quote

Similar Threads

  1. More .htaccess rewrite problems
    By emitind in forum PHP Scripting
    Replies: 0
    Last Post: 10-02-2005, 04:59 AM
  2. Finding directory contents
    By IntellEJent in forum C and C++ Programming
    Replies: 2
    Last Post: 02-13-2005, 08:44 PM