문제

I have this link formats on my webpage:

https://mypage.com/index2.php?page=registration
https://mypage.com/index2.php?page=food&category=1

The first type is replaced as this:

https://mypage.com/registration (works well)

And I would like to format the second as:

https://mypage.com/food/1 (doesn't work, the page is loaded, but the images don't)

So I created the following htaccess file:

RewriteEngine on
RewriteRule ^$ index.php [L]
RewriteRule ^([^/.]+)?$ index2.php?page=$1 [L]
RewriteRule ^food/([^/.]+)?$ index2.php?page=food&category=$1 [L]

But doesn't work. :( What is wrong with this? And where are the pictures? Thank you for your answer.

도움이 되었습니까?

해결책

(doesn't work, the page is loaded, but the images don't)

Probably because your links are relative (doesn't begin with a /) and when you have that extra slash after /food, it changes the URL base (tries to access images in a non-existent /food/ directory). Change all your links to absolute URLs or add a base in the page header:

<base href="/" />
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top