Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Mod-Rewrite Primers? [closed]

I am wondering what primers/guides/tutorials/etc. are out there for learning to rewrite URLs using Apache/.htaccess? Where is a good place to start?

My primary interest is learning how to point certain directories to others, and how to use portions of a URL as parameters to a script (i.e. "/some/subdirs/like/this" => "script.php?a=some&b=subdirs&c=like&d=this").

like image 729
Wilco Avatar asked Sep 23 '08 16:09

Wilco


People also ask

How do I rewrite an Apache module?

In order for Apache to understand rewrite rules, we first need to activate mod_rewrite . It's already installed, but it's disabled on a default Apache installation. Use the a2enmod command to enable the module: sudo a2enmod rewrite.

What are rewrite rules for Apache?

A rewrite rule can be invoked in httpd. conf or in . htaccess . The path generated by a rewrite rule can include a query string, or can lead to internal sub-processing, external request redirection, or internal proxy throughput.

What is RewriteCond and RewriteRule?

There are two main directive of this module: RewriteCond & RewriteRule . RewriteRule is used to rewrite the url as the name signifies if all the conditions defined in RewriteCond are matching. One or more RewriteCond can precede a RewriteRule directive.


1 Answers

I found this to be pretty useful: http://www.addedbytes.com/apache/url-rewriting-for-beginners/

like image 141
swilliams Avatar answered Sep 17 '22 19:09

swilliams