Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Config file for a codeigniter application

I am suffering with a web config file that is not rewrite the url for my codeigniter application. here is the web config file.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Clean URL" stopProcessing="true">
                <match url=".*" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

here is my site : http://gandhitomodi.com

i am not able to get this kind of url http://gandhitomodi.com/controller/method/

for example

http://gandhitomodi.com/welcome/index/

Please Help me through this.

****Edited*****

here is the route.php

$route['default_controller']="welcome/index";
$route['sendmail']="welcome/send";

here is the config.php settings that i have changed.

$config['base_url']="http://gandhitomodi.com/";
$config['index_page']='';
$config['url_protocal']='PATH_INFO';`
like image 799
Dhaval Purohit Avatar asked Sep 21 '16 12:09

Dhaval Purohit


2 Answers

Have you tries this method as mention here

https://blogs.msdn.microsoft.com/azureossds/2015/04/23/converting-apache-htaccess-rules-to-iis-web-config-using-iis-manager-for-azure-websites/

also it is mention over here

https://blogs.msdn.microsoft.com/azureossds/2015/09/28/convert-apache-htaccess-to-iis-web-config/

under the URL Rewriting section. It has the same .htaccess which I am using also there are many online converters to whom you can give a try

like image 192
Vivek Shah Avatar answered Nov 17 '22 11:11

Vivek Shah


For your config file, try this article. It appears that your issue is on your action line.

<action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />

Change that to:

<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />

The question mark is causing your issue. Also, your match line might be changed to:

<match url="^(.*)$" ignoreCase="false" />

That is a bit more specific and might prevent some headaches later on.

like image 2
Danny Flack Avatar answered Nov 17 '22 11:11

Danny Flack