Free Resources, Links, and Insights

I hope to be constantly adding links and articles to this page to share a few of the tricks I have learned over the years. I will try to avoid limiting the topics to web design and tech, although those topics will likely consume the majority of my posts. I am considering using a CMS to keep this page/section organized; I have tried WordPress once before in the past, but I felt it did not integrate well into an already established site. It was all or nothing, in my opinion, and I have no reason or desire to migrate all of Ryno Studios over to WordPress. If anyone has any suggestions, please let me know. I will probably even write something about it here and give you the credit for it, too.

Hiding Your Website's Version's Subdirectory with .htaccess

I am not sure how many people will use this, but it is extremely useful for websites that have had several versions in the past. For example, Ryno Studios is currently on it's 9th remake, but I still have the previous 4 or 5 versions still online. I keep each version in it's own subdirectory, just in case I ever sell a previous design or need some from one of the earlier designs.

This version is actually located at http://www.rynostudios.com/V9/, but most of you should be seeing just http://www.rynostudios.com/ in your location/address bar. This is accomplished using a .htaccess file that resides in my root directory on my web server. If you don't know what a .htaccess file is, you might want to be doing a little research on it, as it is a very powerful tool in the hands of a knowledgeable web developer.

Rather than going through this step by step, I have included comments to let you know what each line does. So here is the full code required for this little trick:

# Turn on rewrites.
RewriteEngine on
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?YOUR_DOMAIN_HERE.com$
# Only apply to URLs that aren't already under the (version) subdirectory.
RewriteCond %{REQUEST_URI} !^/YOUR_SUBDIRECTORY_HERE/
# Don't apply to URLs that go to existing files or folders. (MEGA IMPORTANT)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all remaining links/addresses to include (version) subdirectory.
RewriteRule ^(.*)$ /YOUR_SUBDIRECTORY_HERE/$1
# Also redirect the root folder. (NOT REQUIRED)
RewriteCond %{HTTP_HOST} ^(www.)?YOUR_DOMAIN_HERE.com$
RewriteRule ^(/)?$ /YOUR_SUBDIRECTORY_HERE/YOUR_MAIN_PAGE_HERE [L]
Copyright © Ryan Thaut 2004 - 2008. | All Rights Reserved. | A Ryno Studios Design. | This web site uses valid CSS & XHTML.