Images do not appear with URL Rewrite

525 Views Asked by At

I wrote a rule for URL Rewrite and it works fine, but after I put it in place, the images in the pages no longer appear.

2

There are 2 best solutions below

0
On BEST ANSWER

Use a <base> tag in the head, to solve this problem.

0
On

It's because you have addressed your images relatively, which means their addresses will be rewritten accordingly.

For example, if you page at /folder/page.html gets rewritten to /folder/pages/page and you have an image at image.png the browser will try to locate it at /folder/pages/page/image.png instead of /folder/image.png.

To avoid this, either address them using their absolute path, or use a rewrite condition that avoids rewriting URLs that point to existing files or directories.