SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,738
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Friendly URL - CSS Issue

    Hi all

    I basically have a stylesheet for mobile which kicks in once the device width is detected.
    HTML Code:
    <link rel="stylesheet" media="screen and (min-width : 320px) and (max-width: 568px)" href="css/smartphone.css">
    Everything seems to work until I noticed that my friendly URLs seem to stop the smartphone.css from loading.

    example:

    www.example.com/page.php?id=001 (everything works)
    www.example.com/page/001 (doesn't work)

    I understand this might be a mod_rewrite issue, does anybody now whats causing this?
    Is this a known issue?

    Thanks, Barry
    The more you learn.... the more you learn there is more to learn.

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,617
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by computerbarry View Post
    Hi all

    I basically have a stylesheet for mobile which kicks in once the device width is detected.
    HTML Code:
    <link rel="stylesheet" media="screen and (min-width : 320px) and (max-width: 568px)" href="css/smartphone.css">
    Everything seems to work until I noticed that my friendly URLs seem to stop the smartphone.css from loading.

    example:

    www.example.com/page.php?id=001 (everything works)
    www.example.com/page/001 (doesn't work)

    I understand this might be a mod_rewrite issue, does anybody now whats causing this?
    Is this a known issue?

    Thanks, Barry
    It's a relative URL issue.

    Visiting your second example link would result in the CSS link being www.example.com/page/001/css/smartphone.css

    You'll either want to add a slash at the start of the CSS file's link, or specify an absolute path.

    /css/smartphone.css or www.example.com/css/smartphone.css
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,738
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool!

    Cheers Force Flow, works a treat.

    Thank you,
    Barry
    The more you learn.... the more you learn there is more to learn.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Option #2 is to use the <base> tag as I list in my signature's tutorial.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •