⚙️ Advanced Configuration

URL Rewriting with IIS

Configure URL rewriting for SEO-friendly URLs:

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <!-- Redirect non-www to www -->
        <rule name="Redirect to www" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^(?!www.)(.*)$" />
          </conditions>
          <action type="Redirect" url="https://www.{C:0}/{R:0}" 
                  redirectType="Permanent" />
        </rule>
        
        <!-- Remove .aspx extension -->
        <rule name="RemoveASPX" stopProcessing="true">
          <match url="(.*).aspx" />
          <action type="Redirect" url="{R:1}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Custom Error Pages

Create custom error pages for better user experience:

  1. Create custom HTML files (404.html, 500.html)
  2. Upload to /error_docs directory
  3. Configure in web.config:
<system.webServer>
  <httpErrors errorMode="Custom">
    <remove statusCode="404" />
    <error statusCode="404" path="/error_docs/404.html" responseMode="File" />
    <remove statusCode="500" />
    <error statusCode="500" path="/error_docs/500.html" responseMode="File" />
  </httpErrors>
</system.webServer>

Performance Optimization

Enable Compression

<system.webServer>
  <urlCompression doStaticCompression="true" doDynamicCompression="true" />
  <staticContent>
    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
  </staticContent>
</system.webServer>

Optimize Application Pool

  • Set recycling conditions appropriately
  • Configure idle timeout (20 minutes default)
  • Set maximum worker processes
  • Enable 32-bit applications if needed
  • Configure rapid-fail protection

MIME Types Configuration

Add custom MIME types for special file extensions:

<system.webServer>
  <staticContent>
    <mimeMap fileExtension=".woff2" mimeType="font/woff2" />
    <mimeMap fileExtension=".webp" mimeType="image/webp" />
    <mimeMap fileExtension=".json" mimeType="application/json" />
  </staticContent>
</system.webServer>

Scheduled Tasks (Cron Jobs)

  1. Go to Tools & Settings → Scheduled Tasks
  2. Click "Add Task"
  3. Select task type (Run a command, Fetch URL, Run PHP script)
  4. Set schedule (minute, hour, day, month, weekday)
  5. Enter command or script path
  6. Configure notifications
Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)