Jump to content

IIS short url image bug web.config rewrite url


Recommended Posts

Hi

 

I got trouble to get canonical url working in prestashop v1.5.3.1 on IIS 7.5 webserver

 

My Setup

 

Prestashop v 1.5.3.1 (installed in folder /prestashop/ )

Webserver IIS 7.5 on win 7 

IIS url rewrite add-on is installed  http://www.iis.net/downloads/microsoft/url-rewrite

Short url activated in prestashop ( the .htaccess file exist)

Web.config modified

 

The short url are ok to display product and category but sadly i cant get any picture working, i think my problem is linked to a rewrite url rule

 

here is my web.config

<rewrite>
            <rules>
		<rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^api/?(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/webservice/dispatcher.php?url={R:1}" appendQueryString="true" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}-{R:2}{R:3}{R:4}.jpg" logRewrittenUrl="true" />
                </rule>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url="^([0-9]+)\-([0-9]+)(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}-{R:2}{R:3}.jpg" />
                </rule>
                <rule name="Imported Rule 4" stopProcessing="true">
                    <match url="^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:1}{R:2}{R:3}.jpg" />
                </rule>
                <rule name="Imported Rule 5" stopProcessing="true">
                    <match url="^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:2}/{R:1}{R:2}{R:3}{R:4}.jpg" />
                </rule>
                <rule name="Imported Rule 6" stopProcessing="true">
                    <match url="^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:2}/{R:3}/{R:1}{R:2}{R:3}{R:4}{R:5}.jpg" />
                </rule>
                <rule name="Imported Rule 7" stopProcessing="true">
                    <match url="^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:2}/{R:3}/{R:4}/{R:1}{R:2}{R:3}{R:4}{R:5}{R:6}.jpg" />
                </rule>
                <rule name="Imported Rule 8" stopProcessing="true">
                    <match url="^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:2}/{R:3}/{R:4}/{R:5}/{R:1}{R:2}{R:3}{R:4}{R:5}{R:6}{R:7}.jpg" />
                </rule>
                <rule name="Imported Rule 9" stopProcessing="true">
                    <match url="^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:2}/{R:3}/{R:4}/{R:5}/{R:6}/{R:1}{R:2}{R:3}{R:4}{R:5}{R:6}{R:7}{R:8}.jpg" />
                </rule>
                <rule name="Imported Rule 10" stopProcessing="true">
                    <match url="^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:2}/{R:3}/{R:4}/{R:5}/{R:6}/{R:7}/{R:1}{R:2}{R:3}{R:4}{R:5}{R:6}{R:7}{R:8}{R:9}.jpg" />
                </rule>
                <rule name="Imported Rule 11" stopProcessing="true">
                    <match url="^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/p/{R:1}/{R:2}/{R:3}/{R:4}/{R:5}/{R:6}/{R:7}/{R:8}/{R:1}{R:2}{R:3}{R:4}{R:5}{R:6}{R:7}{R:8}{R:9}{R:1}0.jpg" />
                </rule>
                <rule name="Imported Rule 12" stopProcessing="true">
                    <match url="^c/([0-9]+)(\-[_a-zA-Z0-9-\.*]*)(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/c/{R:1}{R:2}{R:3}.jpg" />
                </rule>
                <rule name="Imported Rule 13" stopProcessing="true">
                    <match url="^c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$" ignoreCase="false" />
                    <action type="Rewrite" url="/prestashop/img/c/{R:1}{R:2}.jpg" />
                </rule>
				
				<rule name="Imported Rule 14" stopProcessing="true">
                     <match url="^.*$" />
                     <conditions logicalGrouping="MatchAny">
                         <add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" ignoreCase="false" />
                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" pattern="" ignoreCase="false" />
                     </conditions>
                     <action type="None" />
                 </rule>
                 <rule name="Imported Rule 15" stopProcessing="true">
                    <match url="^.*$" />
                     <action type="Rewrite" url="/prestashop/index.php" />
                </rule>
				
            </rules>
        </rewrite>

this image link is down it doesnt display anything (error 404)

<img width="124" height="124" alt="" src="http://localhost:83/prestashop/15-home_default/ipod-nano.jpg">

this product link is ok

http://localhost:83/prestashop/musique-ipods/1-ipod-nano.html

How can i solve this picture display bug ?

 

Thanks

 

@+

Edited by isodynwolff (see edit history)
Link to comment
Share on other sites

a fix to get the image working

 

disabled apache module check

use normal url for image file

 

classes/Tools.php

public static function apacheModExists($name)
{
	return true;

classes/Link.php

public function getImageLink($name, $ids, $type = null)
	{
		....
		$uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg';
		
		return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path;
	}
Edited by isodynwolff (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...