我的网页上有这种链接格式:
https://mypage.com/index2.php?page=registration
https://mypage.com/index2.php?page=food&category=1
第一种类型被替换为:
https://mypage.com/registration (works well)
我想将第二种格式化为:
https://mypage.com/food/1 (doesn't work, the page is loaded, but the images don't)
所以我创建了以下htaccess文件:
RewriteEngine on
RewriteRule ^$ index.php [L]
RewriteRule ^([^/.]+)?$ index2.php?page=$1 [L]
RewriteRule ^food/([^/.]+)?$ index2.php?page=food&category=$1 [L]
但是不起作用。 :( 这有什么问题?图片在哪里? 谢谢你的回答。
答案 0 :(得分:0)
(不起作用,页面已加载,但图片没有加载)
可能是因为您的链接是相对的(不是以/
开头),当您在/food
之后有额外的斜杠时,它会更改URL基础(尝试访问非基础的图像)现有的/food/
目录)。将所有链接更改为绝对URL或在页眉中添加基础:
<base href="/" />