Top

RewriteRule in .htaccess

RewriteRule in .htaccess

I was *ahem* inspired to create this meme after spending 2.5 hours getting RewriteRule working on the uWant.com.au Alpha site. Setting the rules themselves up is easy enough but getting them to work happily with code (database queries, and code itself) is the tricky part.

Indeed even getting the SSL side of the code to dynamically load in its own right is a pain in itself, usually that can be solved with a simple ^ depending on how the rules themselves are written and how the base site needs to handle links.

Once set then the next challenge of getting CSS and JS to relative load to the proper url and not the rewritten url, i know it can be handled via some more rules however i usually opt for the base href (handy especially when dealing with html5).

Love it or hate it (and most devs i know hate it) url rewrites are handy and its worth the hair pulling.

Share