Search code examples
phpcss.htaccesshttp-redirectmime

.htaccess redirecting, MIME error


I'm trying to redirect URL like this

http://localhost/web/gallery/dogs

to

http://localhost/web/index.php?section=gallery&name=dogs

To do that, I try with the next .htaccess

RewriteBase /

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^gallery/(.*)$ index.php/?section=gallery&name=$1 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?section=$1 [L]

</IfModule>

I have the next problem, if I write the URL manually, it looks well with correct CSS and without errors. Else, if I use first URL, firefox give me MIME type error with CSS and other files, so, it appears like an old without colors web.

Nobody know how I can solve this?

Thank you!!

Edit:

I'm trying now it online, and happen the same. I don't change anything.

If I try this URL

http://alexander.comyr.com/gallery&name=Historias_del_mar

it goes well, else, trying this:

http://alexander.comyr.com/gallery/Historias_del_mar

it doesn't work properly


Solution

  • Sounds like you need to either make your CSS links absolute, so that they start with /web/ or add the relative URI base to the header of your page:

    <base href="/web/" />
    

    Or if your URI base is just / (as it appears to be in your htaccess file), then:

    <base href="/" />