[RESOLVED] mod_rewrite for SEO-Friendly URLs and relative path issue fixes?
Results 1 to 3 of 3

Thread: [RESOLVED] mod_rewrite for SEO-Friendly URLs and relative path issue fixes?

  1. #1
    Senior Member
    Join Date
    Jul 2005
    Location
    London
    Posts
    214

    resolved [RESOLVED] mod_rewrite for SEO-Friendly URLs and relative path issue fixes?

    Hey,

    Not really sure this is the correct forum but then I'm not 100% there is one for Apache stuff.

    So I would like to introduce SEO-Friendly URLs, i.e. turn
    http://server.com/article.php?id=56
    into
    http://server.com/article/56/title-words-go-here

    And I have the code for that for the .htaccess file
    PHP Code:
    RewriteEngine on
    RewriteRule 
    ^article/([0-9]+)/(.*?)$ /article.php?id=$
    This works fine except that it screws up all my image and style sheet references, which are relative urls: "../images/xxxx.jpg" or "../styles/css.css".

    Reading around it looks like the answer its to hard code them to an absolute path, i.e. http://server.com/styles/css.css

    Is this really the only way or is there a complex way to do it with the rewrite engine?

  2. #2
    Member
    Join Date
    May 2003
    Posts
    62
    put between your <head>section <base href="http://server.com/">
    maybe this will help you

  3. #3
    Senior Member
    Join Date
    Jul 2005
    Location
    London
    Posts
    214
    Painless! Thanks a lot.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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