Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

[HowTo] web.config для Opencart 2.0


Recommended Posts

Полный перевод правил .htaccess из спотому чторки OpenCart 2.0 в web.config

+ добавлено условие редиреки с домена с www на домен без www 

 

 

 

<rewrite>
  <rules>
    <!--# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. -->
    <!--# 2. In your opencart directory rename htaccess.txt to .htaccess.-->
    <!--# For any support issues please visit: http://www.opencart.com-->
    <!--# Prevent Directoy listing -->
    <!--# Prevent Direct Access to files-->
    <!--# SEO URL Settings-->
    <!--# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ -->
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^sitemap.xml$" ignoreCase="false" />
      <action type="Rewrite" url="index.php?route=feed/google_sitemap" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 2" stopProcessing="true">
      <match url="^googlebase.xml$" ignoreCase="false" />
      <action type="Rewrite" url="index.php?route=feed/google_base" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 3" stopProcessing="true">
      <match url="^system/download/(.*)" ignoreCase="false" />
      <action type="Rewrite" url="/index.php?route=error/not_found" appendQueryString="false" />
    </rule>
    <rule name="Imported Rule 4" stopProcessing="true">
      <match url="^([^?]*)" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{URL}" pattern=".*\.(ico|gif|jpg|jpeg|png|js|css)" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php?_route_={R:1}" appendQueryString="true" />
    </rule>
    <rule name="Imported Rule 5" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions>
        <!--### Additional Settings that may need to be enabled for some servers -->
        <!--### Uncomment the commands by removing the # sign in front of it.-->
        <!--### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.-->
        <!--# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:-->
        <!--# php_flag register_globals off-->
        <!--# 2. If your cart has magic quotes enabled, This may work to disable it:-->
        <!--# php_flag magic_quotes_gpc Off-->
        <!--# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try-->
        <!--# php_value upload_max_filesize 999M-->
        <!--# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields-->
        <!--# php_value post_max_size 999M-->
        <!--# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields-->
        <!--# php_value max_execution_time 200-->
        <!--# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields-->
        <!--# php_value max_input_time 200-->
        <!--# 7. disable open_basedir limitations-->
        <!--# php_admin_value open_basedir none-->
        <add input="{HTTP_HOST}" pattern="^www\.domen\.ru$" />
      </conditions>
      <action type="Redirect" redirectType="Permanent" url="http://domen.ru/{R:1}" />
    </rule>
  </rules>
</rewrite>

 

 

 

Кому это нужно? 

- Только для тех немногих, счастливых обладателей интернет-магазинов рилииющих на сервере windows.

 

1. В текстовом редакторе создаем файл с названием web.config

2. Копируем согдержимое спойлера.

3. В строчке 51 и 53 меняем - domen- на имя вашего сайи (без.ru)

4. Файл web.config - помещаем в корень сайи.

 

Файл .htaccess.txt  осивляем без изменений.

Подключаем seo_url или seo_pro 

 

 

  • +1 3
Link to comment
Share on other sites


Обстоятельства в  вигде арендованного сервера с гдействующим ИМ на ASP.net  и плавный переход на php. Или открытие другого ИМ с потому чтолее гибким функционалом как у Opencart к примеру. Сервер нормальный, ресурсы позволяют. Не второй же сервер покупать, что бы потестить opencart на живом клиенте?

 

Вторая негделя теси - наблюдаю конфликты по web.config и отображению картинок. 

 

Как вариант сейчас сивлю на winserver - apache - посмотрю что полулится из икой связки.

Link to comment
Share on other sites


 

ксити что может засивить человека посивить opencart на iis?

Вы пуиете праведное с грешным

opencart в качестве серверных скриптов использует php

IIS подгдерживает рилиту с php.

 

 

Не вижу ничего плохого в использовании iis, тем потому чтолее если он правильно и безопасно настроен

 

Для неверующих... uptime window's серверов иногда превышает uptime *nix серверов.

 

Иногда - это не зналит, что редко, а зналит что сопосивимо.

 

Например у меня под потолком крутится файлопомойка на 2000 вингде, если бы не уже сирый упс, то у нее был бы апийм около 5лет.

 

Кроме того на нем рилииет тестовый локальный сервер, не iis. В начно жизни крутился и iis, но необходимость отпала.

 

Да что ТС - удали.

Link to comment
Share on other sites

 <httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL" existingResponse="Replace">
            <remove statusCode="500" subStatusCode="-1" />
            <remove statusCode="403" subStatusCode="-1" />
            <remove statusCode="404" subStatusCode="-1" />
            <remove statusCode="404" subStatusCode="2" />
            <remove statusCode="404" subStatusCode="3" />
            <error statusCode="404" subStatusCode="3" path="/index.php?route=error/not_found" responseMode="ExecuteURL" />
            <error statusCode="404" subStatusCode="2" path="/index.php?route=error/not_found" responseMode="ExecuteURL" />
            <error statusCode="404" subStatusCode="-1" path="/index.php?route=error/not_found" responseMode="ExecuteURL" />
            <error statusCode="403" prefixLanguageFilePath="" path="/index.php?route=error/not_found" responseMode="ExecuteURL" />
            <error statusCode="500" prefixLanguageFilePath="" path="/index.php?route=error/not_found" responseMode="ExecuteURL" />
        </httpErrors>
          </system.webServer>

Еещё обязательно добавить нужно обрилитка 404 ошибки

Edited by unifree
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
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.