3

I've got a NopCommerce site (ASP.NET MVC) and I'm trying to add a Wordpress blog as a subfolder of the main site.

The installation of Wordpress was fine, all config files have been created and the blog works fine if you browser through it.

However, I now want to setup pretty permalinks by using the name of the post.

Normally when you setup permalinks, it generates either a .htaccess file for Apache or a web.config for Windows IIS7 Url Rewrites.

When I try and save the permalink settings, it sits there trying to load and eventually times out.

I'm guessing that because ASP.NET MVC uses Routes, the Wordpress site doesn't know what to setup.

Can anyone offer me guidance on how I can get the permalinks setup? Do I need to setup a Route on my MVC site perhaps?

4

2 に答える 2

1

In the end I copied a web.config file from one of my existing blogs that is on a standard C# website.

Normally Wordpress generates the web.config file itself. I can only assume that Wordpress hasn't been setup yet to handle installation on .NET MVC websites.

Creating a web.config file, in the root on the Wordpress blog files, containing the following code should get it working:

<?xml version="1.0" encoding="UTF-8">
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <clear/>
                <add value="index.php"/>
            </files>
        </defaultDocument>
        <rewrite>
            <rule name="wordpress" patternSyntax="wildcard">
                <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"/>
            </rule>
        </rewrite>
    </system.webServer>
</configuration>
于 2012-02-14T23:01:58.840 に答える
0

IISにWordPressをインストールすると、わかりやすいURLが機能しないことに気付くでしょう。これは、WordPressが「mod_rewrite」と呼ばれるApacheアドオンを使用したいためです。これを簡単に説明すると、使いやすいブラウザのURLが取得され、実際にはバックエンドでindex.phpに変更されます。この方法の問題の1つは、IISがapachemodをロードしないことです。これを回避する簡単で無料の方法は次のとおりです。

  • IISサーバーで、ISAPI_RewriteLiteをダウンロードしてインストールします。このフィルターは、IISのmod_rewriteの役割を果たします。ダウンロードするときは、必ず無料のLiteバージョンを使用してください。このLiteバージョンは、製品をそれほど制限するものではなく、WordPressブログにとっては完全に問題ありません(無料です)。このチュートリアルのデフォルトの場所にRewriteLiteをインストールするだけです。
  • 次に、ISAPIフィルターをIISサイトに追加します。
    この設定は、IISサイトを右クリックして見つけることができます->プロパティ-> ISAPIフィルタータブ->追加…フィルターに任意の名前を付け、実行可能ファイルへのパスは次のようになります:
    C:\ Program Files \ Helicon \ ISAPI_Rewrite3 \ ISAPI_Rewrite.dll
    両方のウィンドウで[OK]をクリックして、設定を保存します。
  • 次に、C:\ Program Files \ Helicon\ISAPI_Rewrite3に移動します

    ここでは、httpd.confを編集します(注:これは、有料バージョンとLiteバージョンの違いです。有料バージョンでは、Webフォルダーのルートにある.htaccessファイルを編集する必要があります)

  • ワードパッドでhttpd.confファイルを開き、次の行に貼り付けます
    。RewriteBase /
    RewriteCond%{REQUEST_FILENAME}! -f
    RewriteCond%{REQUEST_FILENAME}!-d
    RewriteRule ^(。*)$ index.php?p = $ 1 [NC、L ]
  • このファイルを保存して終了します。
  • IISの変更を完了するには、次のコマンドを開始、実行、および実行します。iisreset / restart
  • それでは、WordPressの設定を変更しましょう。http:// yourblog/wp-adminに移動します
  • 左側のメニューバー->設定->パーマリンクに移動します
  • これで、投稿の外観を選択できます。私はカスタム設定を選択し、次のようにします。/%postname%これは、このブログが今日機能していることを示しています。
  • [変更を保存]をクリックすると、新しいわかりやすいURLが表示されます。
  • 于 2012-02-01T22:36:30.107 に答える