Entries tagged "Apache"

Concrete5 Mod Rewrite to Add Request Trailing Slash

I recently had the need to add a trailing slash to http requests in a Concrete5 application (that did not have pretty urls enabled).  The issue stemed from clients adding links that did not include the trailing slash.  In the interest of keeping things clean, here are the rules I wanted to follow:

  1. Only rewrite urls that contain index.php
  2. Only rewrite urls where the above is satisfied and is followed by at least 1 trailing slash
  3. Only rewrite urls where the above is satisfied and the url ends with at least one valid character (defined below)
  4. Only rewrite urls where the above is satisfield and does not already end with a trailing slash

Read More »

Graduate School Independent Study

This is my last semester of graduate school. In May I will be graduating with a MSCS degree. This semester I am taking an Operating Systems course as well as an independent study. So far the subject matter for the OS course has been good, but what I’m really excited about is my independent study. Last week I submitted my study proposal and on the same day found out that it had been accepted. I am thankful that I have professors who are open-minded (and not stuck in the theoretical muck).  It is my goal to document my progress here on this blog, starting with the posting of my proposal.

Read More »

Remove www Subdomain

It seems that more and more people are moving away from the inclusion of www in their url. SitePoint recently wrote about the subject, and this past February Roger Johansson also wrote an article on the topic. Roger’s article was really more about making sure your site works with our without www (I couldn’t agree more). You wouldn’t get any more from me than you could get from taking a look at the articles I’ve referenced, therefore I’ll just skip to the good stuff. In general I feel that the inclusion of www is just a waste of address bar space. For this blog I have decided to throw it to the dogs. If I remember correctly, “Removing the Ws from URLs“, an article from 2002, was a big help for me on my path to www enlightenment.

Removing WWW through VirtualHost

<VirtualHost ipaddress>
ServerAdmin root@localhost
ServerAdmin webmaster@blueatlas.com
DocumentRoot /path/to/public_html/
ServerName jasonleveille.com
ErrorLog /path/to/logs/jasonleveille.com/error_log
TransferLog /path/to/logs/jasonleveille.com/access_log
</VirtualHost>

<VirtualHost ipaddress>
ServerName jasonleveille.com
ServerAlias www.jasonleveille.com
ServerAlias ww.jasonleveille.com
Redirect permanent / http://jasonleveille.com/
</VirtualHost>

Removing WWW through .htaccess

Perhaps you don’t have access to your VirtualHost block. Not a problem if your host/server/whatever allows you to override directives via .htaccess. This article on using .htaccess from Daring Fireball is a good reference regarding this topic.

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteRule (.*) http://yourdomain.com/$1 [R=Permanent]

Mobify empowers marketers and developers to create amazing mobile web experiences. Tap to learn more

Mobify