background preloader

Url amigables

Facebook Twitter

Beyond Redirect: Using ReWriteRule in .htaccess. Beyond Redirect: Using ReWriteRule in .htaccess June 30th, 2008 in Programming & IT by: Matthew Griffin Mod_rewrite is an Apache module that can be accessed from .htaccess files to perform all kinds of complicated URL manipulation. A few months ago I posted an article called Beat Your Website into Submission with .htaccess explaining how to use several .htaccess features to do helpful tricks; but I didn't really touch on mod_rewrite or RewriteRule. Since then I was involved in a project that required extensive use of mod_rewrite and I've come to truly appreciate its power and usefulness. The main mod_rewrite function, RewriteRule, is powered by regular expressions. Regular expressions are used to search blocks of text for specific patterns. The Setup Before you start messing with RewriteRule, you need to make sure your .htaccess file is ready for tinkering.

Options +FollowSymlinksRewriteEngine onRewriteOptions MaxRedirects=10 RewriteRule Basics Redirecting the Right Way 301 Permanently Moved. Htaccess Rewrites – Rewrite Tricks and Tips. Htaccess Rewrites are enabled by using the Apache module mod_rewrite, which is one of the most powerful Apache modules and features availale. Htaccess Rewrites through mod_rewrite provide the special ability to Rewrite requests internally as well as Redirect request externally.

When the url in your browser's location bar stays the same for a request it is an internal rewrite, when the url changes an external redirection is taking place. This is one of the first, and one of the biggest mental-blocks people have when learning about mod_rewrite... But I have a secret weapon for you to use, a new discovery from years of research that makes learning mod_rewrite drastically quicker and easier. It truly does or I wouldn't be saying so in the introduction of this article. Despite the tons of examples and docs, mod_rewrite is voodoo.Damned cool voodoo, but still voodoo.-- Brian Moore If you really want to take a look, check out the mod_rewrite.c and mod_rewrite.h files. RewriteRule ! Directives ^ The Ultimate Guide to .htaccess Files. Redireccionar, reescribir y crear url amigables; RewriteRule, mod_rewrite y .htaccess.