你如何配置的Windows Azure对于URL重写使用Word preSS? [英] How Do You Configure Windows Azure For Url Rewrite Using WordPress?
问题描述
我刚刚创建使用Windows Azure和他们的一个词preSS博客模板网站。我能我的域名更新CNAME别名和记录,以正确转发到他们的网站。当我去:www.myblog.net,我重定向到:myblog.azurewebsites.net和浏览器显示www.myblog.net,这正是我想要的。
I have just created a website using Windows Azure and their template for a WordPress blog. I was able to update the CNAME and Alias records to properly forward my domain to their website. When I go to: www.myblog.net, I am redirected to: myblog.azurewebsites.net and the browser shows www.myblog.net, which is what I want.
这一切工作正常。该网站加载罚款,一切都很好。
This all works fine. The site loads fine and all is well.
问题,不过,来的时候我试图让一个页面,一个固定链接。通过字preSS的配置,我更新了我的永久链接是格式为:<一href=\"http://www.myblog.net/blog/The-Post-Name-Is-Here\">http://www.myblog.net/blog/The-Post-Name-Is-Here.这样做的问题是,当我试图去那个网址,我得到这个错误:
The problem, though, comes when I try to get to a page with a permalink. Through WordPress configuration, I updated my permalinks to be in this format: http://www.myblog.net/blog/The-Post-Name-Is-Here. The problem with this is that when I attempt to go to that URL, I get this error:
您正在寻找已被删除的资源,更名或暂时不可用。
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
如果我去shortlink为同一主题(如 http://www.myblog.net/?p=241 ),页面被发现,一切都很好。
If I go to the shortlink for that same topic (e.g. http://www.myblog.net/?p=241), the page is found and all is well.
我已经研究这个相当多,并已发现有Apache的URL重写,但显然不会为我工作。我还发现,存在于IIS中的URL重写,我已经用这个本地播放。您可以配置此妥善管理的URL重写。然而,在Windows Azure网站配置门户没有这样的IIS面板。
I have researched this quite a lot and have found that there is a url rewrite for apache, but that obviously won't work for me. I have also found that there is a url rewrite for IIS and I have played with this locally. You can configure this to properly manage the url rewrite. However, there is no such IIS panel in the Windows Azure Websites configuration portal.
我也读了很多有关编辑web.config文件和htaccess的,但无论这些文件都在我的wwwroot目录(或子目录),我在Azure上的网站。
I have also read a lot about editing web.config and htaccess, but neither of these files are in my wwwroot directory (or any child directories) for my website on azure.
因此,没有人知道如何配置蔚蓝的网站,以妥善管理的永久链接?
So, does anyone know how to configure azure websites to manage permalinks properly?
在此先感谢您的帮助!
推荐答案
字$ Windows Azure上的网站p $ PSS下Microsoft Internet信息服务(IIS)中运行,而不是Apache。 IIS还支持URL重写,但配置是在Web.config文件中完成的,而不是在一个.htaccess文件。
WordPress on Windows Azure Websites runs under Microsoft Internet Information Services (IIS), not Apache. IIS also supports URL rewriting but the configuration is done in a Web.config file, not in a .htaccess file.
首先,在Word preSS设置,更改固定链接到自定义结构没有的index.php,如:
First, in WordPress settings, change the permalink to a custom structure without "index.php", such as:
/%year%/%monthnum%/%day%/%postname%/
另外,还要确保在Word preSS设置,常规设置部分,字preSS地址(URL)及网站地址(URL)是正确的。
Also make sure in WordPress Settings, General Settings section, the WordPress Address (URL) and Site Address (URL) are correct.
接下来,使用FTP,WebMatrix中或其他工具,在您的Word preSS网站的根目录下创建一个Web.config文件:
Next, using FTP, WebMatrix or other tool, create a Web.config file in your WordPress site's root directory:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
有关一步一步的教程引用的在Azure上 pretty字preSS固定链接。有关更多信息,请参阅<一个href=\"http://www.davebost.com/2013/07/11/moving-a-word$p$pss-blog-to-windows-azure-part-4-$p$ptty-permalinks-and-url-rewrite-rules\">Moving一个字preSS博客到Windows Azure - 第4部分:pretty固定链接和URL重写规则
For a step-by-step tutorial refer to Pretty WordPress Permalinks on Azure. For additional information refer to Moving a WordPress Blog to Windows Azure – Part 4: Pretty Permalinks and URL Rewrite rules.
这篇关于你如何配置的Windows Azure对于URL重写使用Word preSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!