I am using PHP framework to build my website
I am getting 404 - File not found error when try to access a lik like below.
https://ex.example.com/example
But the index file is routing and working perfect (below link go to the index file)
I am using the following URL structure. note that the .php extention is omitted as all frameworks
https://'domain' / 'module' / 'function' / 'parameter'
I am struggling to do the routing in the windows hosting, I need to clarify 2 things
Options -Indexes RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule !^static index.php [QSA,L]
I am using PHP 5.6
There is no .htaccess on IIS. You can use the web.config XML file for that.
For instance, I used this config with my virtual server on IIS:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to index.php">
<match url="index.php|robots.txt|images|test.php" />
<action type="None" />
</rule>
<rule name="Rewrite CI Index">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Plus, you can see this help section on iis.net to know more about how to translate .htaccess to web.config: https://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig