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?
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:
If you install WordPress on IIS you will notice your friendly URLs do not work. This is because WordPress wants to use an apache add-on called “mod_rewrite.” The quick rundown of that this does is it will take your friendly browser URL and actually change them to index.php on the back end. One problem with this method is that IIS does not load apache mods. Here is an easy and free way around this:
You will find this setting by right clicking yourIIS site -> properties -> ISAPI filters tab -> Add … Name the filter whatever you wish and your path to your executable should be:
C:Program FilesHeliconISAPI_Rewrite3ISAPI_Rewrite.dll
Click OK on both windows to save your settings.
Here we will edit httpd.conf (Note: This is the difference between the pay version and the Lite version. In the pay version you will need to edit the .htaccess file on your web folders root)
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?p=$1 [NC,L]