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 2 of 2

Thread: Rewrite problem

  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    824
    Thanks
    93
    Thanked 18 Times in 18 Posts

    Rewrite problem

    I have added this to my .htaccess file
    Code:
    RewriteRule ^([a-z]+)/([0-9]+)$ /bandtest/layout4/$1/$2/ [R]
    RewriteRule ^([a-z]+)/([0-9]+)/$ /bandtest/layout4/index.php?page=$1&ID=$2
    and it links to the correct file and the variables are correct (for my testing $1=news and $2=46) however all the image files the page contains and the css file dont load. I looked at the source and its looking for them at /bandtest/layout4/news/46/css.css, whereas it needs to be bandtest/layout4/css.css. Anyway i can fix this problem?

    P.S Sorry if none of that makes sense, if it doesn't say so and ill try and reword it

  • #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
    Anyway i can fix this problem?

    P.S Sorry if none of that makes sense, if it doesn't say so and ill try and reword it
    It's a common issue when we use mod_rewrite along with relative paths. What you need is change all the relative paths used in the client sides to link img,js,css files to absolute paths starting with /

    For example, if the above mentioned file is located at
    Code:
    http://yoursite.com/blog/bandtest/layout4/css.css
    then the href of your <link> tag should be
    Code:
    href="/blog/bandtest/layout4/css.css"
    See http://www.codingforums.com/showthre...167#post784167 to read more.
    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
    •