Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Posts
    255
    Thanks
    113
    Thanked 0 Times in 0 Posts

    Mod Rewrite Turns Off CSS

    Go to http://www.hogwarts-rpg.net/category...irth_News&id=3. Now, access the same page via the rewritten URL at http://www.hogwarts-rpg.net/category...Rebirth_News/3. See how nothing seems to be styled on the page that time around? What's up with that?

    My mod_rewrite code for the page is:

    Code:
    RewriteRule ^category_news/([a-zA-Z_]+)/([0-9]+)$ /category_news.php?name=$1&id=$2

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Take a look at CSS, Div,Linking
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Joseph Witchard (04-29-2010)

  • #3
    Regular Coder
    Join Date
    Oct 2008
    Posts
    255
    Thanks
    113
    Thanked 0 Times in 0 Posts
    I don't get it. How does using absolute paths solve the problem? Indeed it does, but how?

  • #4
    Regular Coder Samhain13's Avatar
    Join Date
    Aug 2008
    Location
    Pilipinas
    Posts
    169
    Thanks
    4
    Thanked 18 Times in 18 Posts
    The user-agent thinks that it's getting resources from hogwarts-rpg.net/category_news/Rebirth_News/3, a directory that really doesn't exist. So if you have links for your CSS that are relative, like "mycssfile.css", the user-agent sends a request for "hogwarts-rpg.net/category_news/Rebirth_News/3/mycssfile.css" file.

    However, when using an absolute URI like "/mycssfile.css", the user-agent requests a file relative to the document root (public_html (?)) folder. So it knows that the file's address is "hogwarts-rpg.net/mycssfile.css". And it works if the file is really in that directory.

    Err... sorry if that wasn't clear.
    Last edited by Samhain13; 04-29-2010 at 12:40 PM.
    I am a Man of Truth. I am a Free Human Person. I am a Peacemaker.
    ** Independent Multimedia Artist in Pasig **

  • #5
    Regular Coder
    Join Date
    Oct 2008
    Posts
    255
    Thanks
    113
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Samhain13 View Post
    The user-agent thinks that it's getting resources from hogwarts-rpg.net/category_news/Rebirth_News/3, a directory that really doesn't exist. So if you have links for your CSS that are relative, like "mycssfile.css", the user-agent sends a request for "hogwarts-rpg.net/category_news/Rebirth_News/3/mycssfile.css" file.

    However, when using an absolute URI like "/mycssfile.css", the user-agent requests a file relative to the document root (public_html (?)) folder. So it knows that the file's address is "hogwarts-rpg.net/mycssfile.css". And it works if the file is really in that directory.

    Err... sorry if that wasn't clear.
    No no, you explained it well So it's the /s in the rewritten URL that are causing the problems, right? It's making it think it's a directory?

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    So it's the /s in the rewritten URL that are causing the problems, right? It's making it think it's a directory?
    Yes, absolutely!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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