I have some pictures placed in the C:\xampp\htdocs\catshop\assets\img
folder under my website. If an image has a name like food-adult-wet-meo-sardine-in-prawn-jelly-400g
, it will not show up on the website. However, if the name is like can1.png
or can-1.png
, it will display correctly (even though they are in the same position). If I name it food-prawnjelly.png
, even with just one hyphen, it won't show up. foodprawnjelly.png
doesn’t work either.
If I move the image to C:\xampp\htdocs\catshop\assets\img\food
, it won't show up even though its name "worked" before, like can1.png
.
I don't know if this is related or if it is causing the problem, but I am using rewrite rules to create beautiful links. A link like catshop/food/adult-cat.food
will be rewritten to show-category.php
, where appropriate filtering will be done to show the source from adult-cat -food
products. I've used absolute links for the image paths (e.g. /catshop/assets/img/can-1.png
)
Rewrite rules used: RewriteRule ^(\w )/(\w )$ show-category.php [NE,L]
If you need more information, please let me know, thank you!
catshop ├─ .htaccess ├─ assets │ ├─ bootstrap │ ├─ css │ ├─ fonts │ ├─ img │ │ ├─ can-1.png │ └─ js ├─ index.php ├─ login.php ├─ register.php ├─ show-category.php └─ logout.php
Edit: Contents of .htaccess file
<IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On # 打开重写引擎 RewriteRule home index.php [NC,L] RewriteRule food show-category.php [NC,L] RewriteRule ^((\w+)\/)+(\w.+)$ show-category.php [NE,L] </IfModule>
P粉6046694142024-01-17 09:49:34
According to my understanding,
/catshop/assets
location/catshop/show-category.php
(Please note: you may want to change the use of home as this will match any string containing the word home)
<IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On # 打开重写引擎 RewriteRule home index.php [NC,L] RewriteRule ^((?!assets)\w+\/)+(\w+\.\w+)(?<!\.php)$ catshop/show-category.php [NE,L] </IfModule>
This will find any URL part that does not contain the words assets
or .php