Rewrite breaking all my images :(

Posted on 2006-05-30
Last Modified: 2010-05-18
# htaccess rewrite modules for ccp
RewriteEngine On
# don't write category.php
RewriteRule ^category\.php - [L]
Rewriterule ^cat/(.+) category.php?$1 [L]

I found "RewriteRule ^.+/images/?(.*)$ /images/$1 [R=301,L]" -- but the thing is, that only allows images to be in root level/images :( and I have an administration interface /ccp/ that also has images and css folders etc that will also need to utilize that.  So in putting that rule in, it basically takes away the ccp's images folder so that isn't acceptable.  Sadly, though, I can't figure out what I can do but I need to assume there are going to other images folders within sub folders and they will need to work :(  Anyways onto the other part below.

Basically with this rewrite, as you can see, I'm trying to rewrite a url like this /cat/soda/coke/cola/can or /cat/soda/coke/cola/bottle or infinite other categories / sub categories.

Basically all of my images on category.php (the page I rewrite to) are broken :(  And I can't figure out how to write my rewrite rule to where it actually shows the images even if the browser is pointed /cat/whatever/im/at/... etc...

Any help is much appreciated!
Question by:lamerhooDJV
    LVL 1

    Author Comment

    Also, just so you know, the images can be directly accessed so it isn't blocking or rewriting the folder.  I'm lost.
    LVL 1

    Author Comment

    I have found that <img src="/images/file.ext"> works... but I'd like to know if there are any other ways.
    LVL 1

    Author Comment

    Ack, also urls have an issue :(
    LVL 27

    Accepted Solution

    You can try to use a <base href="">

    One very simple way to prevent this relative linking problem is to use dashes instead of slashes.
    LVL 1

    Author Comment

    hmm true true

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now