We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

URL Rewrite and MagentoRSS

12 replies

Last post Jul 20, 2015 09:32 AM by ricardoquiroz

  • URL Rewrite and Magento

    Oct 06, 2008 07:29 AM|Jim Cooper|LINK

    Has anyone tried using the URL Rewrite Module with Magento. I currently have Magento working with IIS7 and the Helicon ISAPI_Rewrite Lite but have not been able to make the URL Rewrite Module work.

  • Re: URL Rewrite and Magento

    Oct 06, 2008 01:13 PM|ruslany|LINK

    Could you add more details on what does not work? Also could you share the ISAPI_Rewrite rules that work?

    ISAPI_REWRITE

  • Re: URL Rewrite and Magento

    Oct 06, 2008 02:44 PM|Jim Cooper|LINK

    Here are the rules that Magento uses and have been working with Helicon

     Options +FollowSymLinks
        RewriteEngine on
        RewriteBase /magento/
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
        RewriteRule .* index.php [L]

  • Re: URL Rewrite and Magento

    Oct 06, 2008 02:44 PM|Jim Cooper|LINK

    Here are the rules that Magento uses and have been working with Helicon

     Options +FollowSymLinks
        RewriteEngine on
        RewriteBase /magento/
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
        RewriteRule .* index.php [L]

     
  • Re: URL Rewrite and Magento

    Oct 06, 2008 03:41 PM|ruslany|LINK

    The only thing that looks suspicios here is the rule that sets the environment variable. URL rewriter does not support this. Does Magento rely on this environment variable?

    There is also a RewriteCond that uses "-l" flag, which is not supported by URL rewriter, but I do not think this will affect anything, so this condition can be removed.

    magento

  • Re: URL Rewrite and Magento

    Oct 06, 2008 07:19 PM|Jim Cooper|LINK

    I believe I could remove the rule that sets the environment variable; I've seen setups where this was commented out.

    The other issue which I'm not sure about relates to the fact that Magento runs only with PHP set to ISAPI mode. Is it true that the URL Rewrite Module runs only with CGI apps?

  • Re: URL Rewrite and Magento

    Oct 06, 2008 07:52 PM|ruslany|LINK

    URL rewrite module runs with any kind of applications. But using of FastCGI module with URL rewriter ensures that the REQUEST_URI server variable will be set to contain the original URL before it was rewritten. This server variable used by many PHP apps to figure out the original URL, and from the rewrite rules used by Magento, it looks like this app also may be using REQUEST_URI.

    You can try to check if this server variable is set when running PHP via ISAPI and if it is set then what value it contains when using URL rewriter - original or rewritten URL?

    ISAPI_REWRITE

  • Re: URL Rewrite and Magento

    Mar 16, 2009 08:59 AM|Andreas Broicher|LINK

    Hi,
    I am realy not getting further searching google and iis.net I still can not find any hints on how to translate this :

    Options +FollowSymLinks
        RewriteEngine on
        RewriteBase /magento/
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
        RewriteRule .* index.php [L]

    Into a valid code for the URL rewriter from microsoft.

    It starts with the RewriteBase as unkonw command?
    continous with the HTTP:Authorization, that he does not know the parameter E and so on.
    Is there any help her for this issue, I would love to donate or buy a couple of beers for a solution :O)

     Andreas

    magento <rewrite>

  • Re: URL Rewrite and Magento

    Mar 16, 2009 09:17 AM|Andreas Broicher|LINK

    Options +FollowSymLinks
        RewriteEngine on
        #RewriteBase /magento/
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        #RewriteCond %{REQUEST_FILENAME} !-l
        RewriteRule .* index.php [L]

     This is what I have now, because -l is not supported, but why is the RewriteBase command not supported?, Does anybody have an Idea for me?

    magento <rewrite>

  • Re: URL Rewrite and Magento

    Mar 17, 2009 01:32 PM|ruslany|LINK

    This translatest to: 

        <rule name="Imported Rule 1" stopProcessing="true">
          <match url=".*" ignoreCase="false" />
          <conditions>
            <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>

    By placing the web.config with this rewrite rule into the /magento directory you will get the same behavior as you would get with mod_rewrite RewriteBase directive.

    rewritebase

  • Re: URL Rewrite and Magento

    Jan 23, 2011 04:28 PM|AngeloBestetti|LINK

    I did everything on the installation script, create de web.config and after finish install I can browse the frontend and the backend, but....... If I try to see Catalog, Orders, Customers everything else I got the message: The service is unavailable. I didn´t install Zend Framework just the PHP Version 5.3.5 and IIS FastCGI Any ideas?
  • Re: URL Rewrite and Magento

    Jan 23, 2011 06:48 PM|HCamper|LINK

    Hello,

    Could you post the error message that your getting?

    Could post information about the Windows your using?

    Could you post the error information from the server log tfor the errors?

    Could you post the php_errors.log?

    The message service is unavailable can have several causes.

    Have you checked that the "IUSR" and "IIS_USERS" have permissions to access the site?

    Have you checked the "Handler Mappings" for "PHP"?

    Does the error happen only in this "install" script?

    Does the "PHP" work for a simple test?

    Test  script for php.

    create test.php in root folder

    edit the file insert

    <html>
    <head>
    <title> PHP Test Script </title>
    </head>
    <body>
    <?php
    phpinfo( );
    ?>
    </body>
    </html>

    go to the script http:// localhost / test.php

    If it works you get the PHP settings.

    If it does not work PHP or server permissions are wrong.

    Post logs,excat error messages & Questions to this thread.

    Martin :)

    Windows and Linux work Together IT-Pros
    Community Member Award 2011
  • Re: URL Rewrite and Magento

    Jul 20, 2015 09:32 AM|ricardoquiroz|LINK

    I usually don't reply to posts, but I found the solution.

    https://gist.github.com/sabbour/e49b3ac9e1438c93d5fb

    just create a web.config file on notepad or edit the one you have on the root folder of magento, and copy and paste this:

    <?xml version="1.0" encoding="UTF-8"?> 
      <configuration> 
      <system.webServer> 
        <rewrite> 
          <rules> 
            <rule name="Remove index.php rule" stopProcessing="true"> 
              <match url=".*" ignoreCase="false"/> 
              <conditions> 
                <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" /> 
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
              </conditions> 
              <action type="Rewrite" url="index.php" /> 
            </rule> 
          </rules> 
        </rewrite> 
      </system.webServer> 
    </configuration>