Results 1 to 10 of 10

Thread: .htaccess

  1. #1
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default .htaccess

    Hii

    Second question i know, but google aint much help since it just slaps code in my face, and not sure what to do with it, so;

    I have a website, and the url's are index.php?page=PAGEHERE
    Now, how could i use modrewrite to make /page/PAGEHERE

    Many Thanks
    Luke

  2. #2
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^page/([a-z]+) http://site.com/index.php?page=$1 [NC]
    Editted it abit from http://corz.org/serv/tricks/htaccess2.php

    Im not an expert but this looks like it could work

    Hope this helps

    Lew.
    Last edited by LMS16; 03-01-2010 at 05:16 PM.
    Im not here to be loved, I love to be hated :-}


  3. #3
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Sorry to hijack your thread but I was wondering how you could turn:

    sitename.com/index.php?p=login

    into:

    sitename.com/login
    Vouches
    [x][x]

  4. #4
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    Im guessing...

    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^([a-z]+) http://site.com/index.php?p=$1 [NC]
    or sumit like tht... lol

    Lew.
    Im not here to be loved, I love to be hated :-}


  5. #5
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Lewiie15 View Post
    Im guessing...



    or sumit like tht... lol

    Lew.
    That would work.

    http://www.addedbytes.com/cheat-shee...e-cheat-sheet/

  6. #6
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Quote Originally Posted by Fazon View Post
    Sorry to hijack your thread but I was wondering how you could turn:

    sitename.com/index.php?p=login

    into:

    sitename.com/login
    Just a few changes to the previous answer to allow uppercase letters/numbers/hyphens/underscores in the url as well (I think this will work anyway lol):

    Code:
    RewriteEngine on
    RewriteRule ^([a-zA-Z0-9_-]+) http://site.com/index.php?p=$1 [NC]
    You could also just do a wildcard match but it doesn't make much difference.
    Last edited by Invent; 04-01-2010 at 01:05 AM.

  7. #7
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    What does the $1 mean/do?
    Vouches
    [x][x]

  8. #8
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    its the input after the = sign. So the $1 would equal "HELLO" if the url was "index.php?p=HELLO".

    If there were two inputs (index.php?p=HELLO&x=HOWDY) $1 would equal HELLO and $2 would be HOWDY

  9. #9
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    worked perfectly thanks! +rep to all contributions

  10. #10
    Join Date
    Nov 2005
    Posts
    4,486
    Tokens
    921

    Latest Awards:

    Default

    Quote Originally Posted by Blinger View Post
    its the input after the = sign. So the $1 would equal "HELLO" if the url was "index.php?p=HELLO".

    If there were two inputs (index.php?p=HELLO&x=HOWDY) $1 would equal HELLO and $2 would be HOWDY
    Nice explanation for all, including the thread starter +REP.
    "RETIRED" FROM HABBO(X)

    :¬:

    TOMSPIT / COWLY05


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •