So I've created simple .htaccess file as following to make my webiste more SEO:
# PROTECT FILES
<FilesMatch "\.(htaccess|htpasswd|ini|fla|psd|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
#TURNED REWRITE ON
RewriteEngine on
#REWRITE CONDITIONS
RewriteRule start index.html
RewriteRule aboutMe about.html
RewriteRule contact contact.html
RewriteRule portfolio portfolio.php
RewriteRule reportage reportage.php
But the problem is that my images don't load properly. I used for them previously:
<?php
$files = glob("reportageImages/*.jpg");
for($i = 0; $i < count($files); $i++){
$imageDir = $files[$i];
echo '<li><img src="'.$imageDir.'" alt="reportage"/></li>';
}
?>
or directly without php:
<img src="reportageImages/lama.jpg"/>
and the directory was xamp/htdocs/MG/reportageImages/(here .jpg file) as I'm using xaamp to test my project.
I'm quite mislead by similar questions asked, as for some problems really sounding as mine works simply <base href="/" />
, unfotunately not for me.
So I would really appreciate any help from you guys, I'm missing sth and tutorials over Internet don't cover all the topics. What worry me also is if in some way I would come over it, would the solution differ if I moved from local server to hosting?
Added photo to better visualize path problems:
Photos are counted well in directory ( I do same operation for each one and got relevant numbers of broken images boxes).
xamp/htdocs
or/xamp/htdocs/MG
? "don't load properly" - do you mean they don't load at all, ie. 404? You imply that it is only since implementing your .htaccess file that the images have stopped loading - but nothing in your .htaccess file should have changed this?xamp/htdocs
then thehref
attribute of thebase
tag should be/MG/
(or/MG/start
), not/
- however - it is not obvious from what you have posted why the relative path, with nobase
tag, is not working.src
attribute in the HTML (page source)? You certainly shouldn't be seeingfile:///D:/xamp/htdocs/
- that is as if you are trying to load a resource outside of your webserver, from the local filesystem?! Are you actually seeing the text$imageDir
in the reported URL?!