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

    Join Date
    May 2012
    Posts
    7
    Rep Power
    0

    Mod_rewrite messing up relative paths


    My current URLs look like this:
    foo.com/Articles.php/Article=New_Name

    what I want to start using is:
    foo.com/Articles/New_Name

    the rewrite rule I have is:
    RewriteRule ^/?Articles/([a-zA-Z_]+)/?$ /Articles.php?Article=$1 [L,QSA]
    It's working except that it appears that all my paths have been screwed up (paths to CSS, javascript, images) as if the file being read is actually in a different directory. I could make all paths absolute throughout the site but I'd rather get it fixed with mod_rewrite. How do I do this? Thanks in advance.
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,245
    Rep Power
    9400
    mod_rewrite isn't the solution. You can brute-force it and make it work, same way you could use pliers to hammer a nail, but really you should fix the links to use absolute URLs.

    But I'm surprised: you haven't changed the page "depth", in that it used to be foo.com/1/2 and it's now foo.com/1/2, so that shouldn't have changed anything. Did the old URL use trailing slashes?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    7
    Rep Power
    0
    Thanks.

    The URLs didn't have trailing slashes before, and the page depth thing is what has been puzzling me as well. Guess I'll switch to universal paths.
  6. #4
  7. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,245
    Rep Power
    9400
    Have you figured out why they don't work? What URLs does your browser try to fetch?

IMN logo majestic logo threadwatch logo seochat tools logo