SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess with 2 rules?

    Not sure this is the right forum, but I'. trying to figure out how to make 2 mod_rewrite rules within the same htaccess file. I have 2 main pages, index.php and users.php. users.php is if a user is logged in. Now what I want is a address like this: mydomain.com/users.php?ga=news&cn=238479&user=342 should look like this: mydomain.com/news but I havent have luck with this...

    This is what I have done:
    Code:
    AddDefaultCharset UTF-8
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} !/$
    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ users.php?ga=$1 [QSA]
    Thanks...

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    mod_rewrite allows you to map requested URIs to internal URIs using regular expressions

    that is all

    it can't create the "cn=238479&user=342" part since that data doesn't appear in the requested URI ("/news")

    this logic probably belongs in your PHP code, not a URL rewriting rule


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
  •