I want to create flat links for my site. The .htaccess
code .htaccess
as follows:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([0-9A-Za-z]+)?$ /index.php?page=$1 [L] RewriteRule ^([0-9A-Za-z]+)/?$ /index.php?page=$1 [L] </IfModule>`
Now my site is working, and it can be seen through print_r($_GET)
and get all the values.
My site has this code: <img src="images/icons/image.png" />
, where the image is on the path: /images/icons/up.png
.
Now I can visit my site as: http://somedomain.com/home
and everything works fine. But when I put: http://somedomain.com/home/
, it got stuck.
The image gets this path for the browser: http://somedomain.com/home/images/icons/image.png
, which is not available, and it should be: http://somedomain.com/images/icons/image.png
.
How to solve this?
It would be helpful if there was any solution by changing .htaccess , since I want to use relative paths for all links, not the full path.
Thanks Ben Clifford for your help. According to him, if I redirect the second rule to a format similar to the first, and not to index.php. Then it should work.
source share