Brinkster Knowledge Base

KB Home   /  Support  /  Supported Apps  /  WordPress  /   Wordpress permalinks with web config
Wordpress permalinks with web config Articles

Wordpress permalinks with web.config


If you have any issues getting into wp-admin or changing the url see the bottom section about phpmyadmin and troubleshooting


If you are just installing or have a previous install that is doing a “redirect looping” or permalinks have broken, you will need to switch from the old coding using .htaccess to the new version using web.config.


Start with uploading your files to either a folder, or directly to webroot.


This example will be with a subfolder Please see this guide for a full install setup of wordpress




Normally you would browse to http://domain.com/foldername/wp-admin/install.php


Run through the installer to set it up


This is typically how it would look for the url:

http://domain.com/foldername/?p=8
http://domain.com/foldername/?page_id=6





To change it so it looks like domain.com/postname will need to make a few changes.


  1. Edit/add the web.config redirect code

  2. Move/edit the index.php (if its located within a folder more on this step later)

  3. Edit the site url / home url

  4. Edit the premalinks option.



Edit/add the web.config redirect code


Login to www.brinkster.com and go to the file manager (or use ftp to upload the file from your computer).

Go into webroot\ and create a new file called web.config


Edit the file and add the following code



<?xml version="1.0" encoding="UTF-8"?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="WordPress Rule" stopProcessing="true">

<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>

</rules>

</rewrite>

</system.webServer>

</configuration>


NOTE: if you have multiple sites, you may need to make some changes/custom edits to make it work.  This tells it match url=".*" (anything), load the index.php file. This is simply the basic instructions for a single site. Now because we have it in webroot\foldername, there is no index.php file in webroot.



Move/edit the index.php


From file manager (or ftp program) copy the index.php from within your folder and paste it in the webroot.


**NOTE** If you have it INSIDE webroot, not in a sub folder, you can skip this part


Edit the new index.php and add the folder to the path it lists:

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

now becomes:

require( dirname( __FILE__ ) . '/foldername/wp-blog-header.php' );  (Note I am using "wordpress' as my folder, enter your folder name there)



What this does is the web.config tells it to load this file, which loads into the wordpress files you have uploaded.



Edit the site url / home url


Login to wp-admin. Once logged in (or if it was a previous install, simply login), go into:


Settings >> General >>

Change the wordpress address (URL) to be http://domain.com/foldername

Change the site address (URL) to be http://domain.com

**NOTE** If you have it INSIDE webroot, not in a sub folder, you can skip this part

**Note** If you are unable to login (url is messed up) See troubleshoot below for editing the same lines within the database using phpmyadmin.




Edit the premalinks option.


From the Settings tab, select permalinks

Under custom structure, enter /%postname%/ or pick the radio option for:

Post name http://domain.com/foldername/sample-post/




After making the switches, you should be able to reload your pages (may need to type domain.com if they still show domain.com/foldername/page.id when mousing over the links.


http://domain.com/testpage1/




Troubleshooting


If you can’t get into wp-admin to make the changes (due to whatever reasons) you will most likely need to use a database editing program.


Phpmyadmin has one that can either be run from your computer (has requirements to run), or uploaded to the website and loaded there.

How to install phpmyadmin

How to use FTP to upload files (in this case phpmyadmin)


Be sure to upload it to its own folder, say webroot\phpmyadmin.


Browse it by going to domain.com/phpmyadmin.


If you get this notice or one similar, you simply need to update your php version.  This is also done in the web.config, please follow this guide on how to change/pick your version.


PHP 5.5+ is required.

Currently installed version is: 5.3.29



Once logged into phpmyadmin, select your database (your username) on the left to expand it.

FInd whatever you called your "prefix"_options



Find your prefix, if you didnt change it in the wp-config when installing wordpress it will be wp_


Find prefix_options

I called my prefix test, so that’s how mine looks.



Heres where you can see the site url and home url (from the settings >> general tab).  Can also see/change the permalink_structure, just double click in the field to edit, make the change and click out to post it.