Greetings. Tell me

//.htaccess AddDefaultCharset utf-8 DirectoryIndex index.php RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?myget=$1 [L,QSA] 

We do this, then all the pictures disappear on the site:

 // вот так mysite.ru/test/ // /img/logo.jpg - ищется как mysite.ru/test/img/logo.jpg (что есть неправильно) // картинка реально в mysite.ru/img/logo.jpg 

Googled, searched - dully. Option 2:

  1. Specify absolute addresses (which is possible, but full of sites without this cost)
  2. Indicate how the directory from which to look at all the addresses (basic so to speak)

Question: Tell me, is it possible to somehow specify this very basic path for all JS / CSS files, so that there are no glitches with addresses? And where is it prescribed?

ps fixed 1 error

  • Try this: RewriteEngine on RewriteBase / - VenZell
  • wrote. Now the site at mysite.ru/test/ - throws to the genitive directory. How to be? - sergey
  • And if so? RewriteEngine on RewriteCond% {REQUEST_FILENAME}! -F RewriteCond% {REQUEST_FILENAME}! -D RewriteCond% {REQUEST_URI}! \. (Js | css | jpe? G | gif | png) $ RewriteRule ^ (. *) $ Index.php ? myget = $ 1 [L, QSA] - VenZell
  • no Unfortunately. Well, you have to install some kind of CMS and unzip it to the ground. They also use similar addresses and work. - sergey

1 answer 1

When addressing the image, you need to put a slash to indicate what to read from the root. For example:

 <img src="/img/logo.png" /> 

Once you say that with mysite.ru comes in normally, then this is exactly the problem.
Or try:

 <img src="../img/logo.png" /> 

If the problem persists, then apparently the server is not properly configured, you need to contact the hoster.

  • mmm .. indicated a picture with the first slash - no pictures. I apologize, with mysite.ru - it turns out the browser image from the cache pulled. not her there - sergey
  • Mm, that's not the problem. As long as you figure it out, write to the host after all, unless it’s your server =) There will be no excess. Because everything should work with a slash in front - iproger
  • Now it all worked on mysite.ru. on mysite.ru/test/ - redirect to the root. those. 1 problem was solved, another one appeared - sergey
  • Strange, this should not be. Try RewriteRule (. *) / $ Index.php? Myget = $ 1 [L, QSA] - iproger
  • try to change index.php to index2.php. Let's see, maybe he just myget does not transmit - iproger