I have the following code to create a friendly URL for the user.
- Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/(.*) ./index.php?company=$1&code=$2
With this exactly code I am obtaining to catch the parametros “company” and “code” calmly saw PHP:
http://localhost/helio/publication/cocacola/35
- Code: Select all
<?php
echo $_GET["company"] . "<br>\n"; // print cocacola
echo $_GET["code"] . "<br>\n"; // print 35
?>
However my archive index.php is not obtaining to find the images in the directory “imgs”. When I execute the command echo of one tag image the same one does not appear in browser, therefore a wrong way is given it.
- Code: Select all
<img src="imgs\flag.jpg">
Browser considers the parameter company as part of the address of the image:
<img src="http://localhost/helio/publication/cocacola/imgs/flag.jpg">
Where the correct one would be:
<img src="http://localhost/helio/publication/imgs/flag.jpg">
This if complicates more when increase the number of parameters passed in the URL:
http://localhost/helio/publication/cocacola/light/50
or
http://localhost/helio/publication/cocacola/zero/50
Result:
<img src="http://localhost/helio/publication/cocacola/light/imgs/flag.jpg">
or
<img src="http://localhost/helio/publication/cocacola/zero/imgs/flag.jpg">
If somebody will be able to help I is thankful to me very.
It forgives for writing badly in English, I am using the translator of the Google.