Friendly URL on Windows 2003/2008 hosting with PHP site

Asked

Viewed 847 times

1

I need to convert this file .htaccess for a Windows hosting compatible format at Locaweb.

RewriteEngine On 
RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?link=$1 [L] 

In support with Ocaweb guide me to read this link. http://ajuda.locaweb.com.br/pt-br/Isapi_Rewrite#Vers.C3.B5es

However I am not able to understand the difference, and the links work, what does not open are the files.

  • By chance which framework MVC para PHP you are using ?

  • Dear Fulvio, I use my own framework with PHPOO, PDO and Smarty

  • Very cool, maybe my answer will do, you already tested?

1 answer

1


The URL Rewrite which is installed in the Server IIS, where I use to run my websites with PHP Friendly URL.

Link to Install Extension: http://www.iis.net/downloads/microsoft/url-rewrite

Since you must not have installed the IIS, I converted for you by the configuration passed in the question and would be like this by the Rewrite.

Create a file with this name and extension web.config and paste in that Xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" enabled="false" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{SCRIPT_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{SCRIPT_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?link={R:1}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

There is one however, this rule may work if it is the only .htaccess in your project, if you have more you have to generate one for each ...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.