WarpConduit Computing

  • Quick Tips
  • Web Development
  • WordPress Plugins
  • Home
  • Passphrase Generator
  • Password Generator
  • About
  • Contact

RewriteRule and Trailing Slashes

May 7, 2010 by Josh Hartman

Just a quick post today, i needed to redirect a URL with and without a trailing slash to the same destination, but didn’t want to create two separate rules, so I did some searching and found that it is very simple.

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^video(/)?$ http://video.somedomain.com [R=301,L]

The (/)? is the key to matching a url with or without a trailing slash.

Filed Under: Web Development Tagged With: htaccess, rewriterule, slashes

Connect

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • YouTube

Recent Posts

  • How to Permanently Remove the “Learn about this picture” Spotlight Wallpaper Icon From Your Windows Desktop
  • How to Quickly Test a Fax Machine
  • Extremely Useful Applications for Web Development and IT Tasks

Tags

automatic benchmark bigint class composer css embed escape event font function gzip helper htaccess html htmlspecialchars image increment javascript jquery list magento media mysql number observer opencart order output photo php profiling random redirect rijndael software text type ubuntu url windows windows 7 wordpress xampp xss

Blogroll

  • CodeIgniter
  • Fusion Forward
  • jQuery
  • Nettuts+
  • Smashing Magazine

© 2025 WarpConduit Computing. All Rights Reserved.