Design/build: WordPress themes

from design prototype to theme : how to get started

pretty permalinks

We can choose to install our WP site into the root directory of our server, or keep the files within a sub-folder. My usual approach is to place all WP files into a folder in root. This allows for the holding page in the main directory to remain in place while the theme is being developed and built — and makes the launch as simple as switching a switch :) This article will outline the core points.

Lucky for us, WordPress will assist in taking care of the relevant changes to the URL structure and update the .htaccess file accordingly. We will use the general settings for the permalink structure to add in the 2 different URLs for our site:

  1. WordPress Address (URL)
    this is where WP lives, i.e. the directory of all WP files
    in the case of this very site this means: https://eyelearn.org/seewp
  2. Site Address (URL)
    this is the domain’s main URL which will access the site’s homepage.
    in the case of this very site this means: https://eyelearn.org

NOTE: as this domain is not using this site as main website – the details here are for demo purpose only.

Once you save these changes to the settings, WP will add the relevant code to your .htaccess page and this should be it. You can check on the htaccess file to see the Rewrite rule added.

3 parts in place

For a pretty permalink which removes the sub-folder name – we’ll have the following in our root directory:

  1. seewp —— the folder for WP
  2. index.php —— setting the WP site as main site for the domain
  3. .htaccess —— switching on the RewriteEngine

index.php

<?php
// WordPress 
define( 'WP_USE_THEMES', true );
require( './seewp/wp-blog-header.php' );

.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If all is working as it should – there’s no need for you to edit anything other than your URL settings :)

As final step, don’t forget to edit the permalink settings to suit.

September 23rd, 2021 by prisca