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.
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: