Answer the question
In order to leave comments, you need to log in
How to fix htaccess problem in yii?
There is an old site on Yii1 on it, it would seem that it was necessary to do a seemingly elementary thing, 301 redirect from pages without a slash to pages with a slash, this is done quite simply in 99% of cases RewriteRule ^(.*)([^/]+)$ /$0/ [R=301,L]
, everything is fine with a line with a redirect, but only after that all images cease to be displayed on the site ! After this entry in htaccess, all image addresses on the site become 404. I don’t understand how one affects the other, but is it possible to somehow add exceptions for image addresses to this code?
Answer the question
In order to leave comments, you need to log in
Apparently, you get photo addresses /images/somename.jpg/ and this is not correct, so you need to exclude everything that contains a dot from the rule. As a rule, these things in htaccess are already ruined in yii. So that part of the requests (exactly the part for which your rule should work) goes through index.php So most likely you just inserted your rule in the wrong place. If you could paste your entire htaccess into the question, it would be easier. And they would also give an example of a link with a picture that does not work. Since so far everything I have written is just a guess.
The problem is not in .htaccess
, but in the fact that the webmaster, who made up the template, indicated the sources of images and css with relative URLs
Without "/" at the beginning of src, or at worst, all images and css must be src addresses with the full http:// domain. com/xxxx.css
For it is clear that when you go/redirect from an address like domain.com/yyyy to domain.com/yyyy/
The last option is perceived by the browser as a subdirectory and all relative html resources fall off;)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question