Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

For this website both the urls,

http://bonsaiframework.com and http://www.bonsaiframework will work.

However, in some cases you want to force what a consistent url for a variety of reasons,

  • Vendor or product code that works with only a specific url.
  • Improve index results from search engines

This can be accomplished using Apache's Rewrite.

Enable Rewrite Module

Verify Rewrite Module

Apply Directives

# Enforce www in front of url.
RewriteEngine On
RewriteCond %

Unknown macro: {HTTP_HOST}

!^www\.bonsaiframework\.com$ [NC]
RewriteRule (.*) http://www.bonsaiframework.com$1 [R,L]

I usually place these rules right after my ServerAlias lines in my virtual host.

Test

Debugging

  • No labels