#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    129
    Rep Power
    11

    Mod Rewrite Frustration


    I am trying to do a very simple mod rewrite and I cannot seem to figure out the correct way to do it.


    I want something like this.

    on this page. www.domain.com/foo

    I have links that look like so

    www.domain.com/foo/bar

    I want those links to go to

    www.domain.com/foo/baz.php?name=bar

    I think the problem is occurring because these links are urlencoded meaning they have % signs and things like that

    Here is what I have.

    RewriteRule ^/(.+)$ club.php?name=$1 [L]
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,053
    Rep Power
    9398
    I don't see how you turned
    I have links that look like so

    www.domain.com/foo/bar

    I want those links to go to

    www.domain.com/foo/baz.php?name=bar
    into
    Code:
    RewriteRule ^/(.+)$ club.php?name=$1 [L]
    Where'd the subfolder go?

    Originally Posted by drumn4life0789
    I think the problem
    What problem would that be?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    129
    Rep Power
    11
    well I have the htaccess file in the foo sub folder.

    and the rewrite should say

    RewriteRule ^/(.+)$ baz.php?name=$1 [L]

    Im just lost. I want.

    www.domain.com/foo/anythinghere

    to actually go to here.

    www.domain.com/foo/baz.php?name=anythinghere
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    If you define rewrite rules in a .htaccess file in a subdirectory you need to specify a RewriteBase directive in the .htaccess file.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo