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.
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.
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.
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.
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?
Thanks in advance for your help!
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.
First, in WordPress settings, change the permalink to a custom structure without "index.php", such as:
/%year%/%monthnum%/%day%/%postname%/
Also make sure in WordPress Settings, General Settings section, the WordPress Address (URL) and Site Address (URL) are correct.
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>
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.
if your wordpress blog is configured as www.myblog.net then in your permalink you can not have /blog until and unless you have changed that in your wordpress settings. I think your permalink should look somethimng like http://www.myblog.net/index.php/The-Post-Name-Is-Here
Go to settings -> permalinks and either select one of the options from there. Or if you want custom url then type - /index.php/%postname%/ and save.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With