Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))

Well House Consultants
You are on the site of Well House Consultants who provide Open Source Training Courses and business hotel accommodation. You are welcome to browse and use our resources subject to our copyright statement and to add in links from your pages to ours.
Other subject areas - resources
Java Resources
Well House Manor Resources
Perl Resources
Python Resources
PHP Resources
Object Orientation and General topics
MySQL Resources
Linux / LAMP / Tomcat Resources
Well House Consultants Resources
Extras Resources
C and C++ Resources
Ruby Resources
Tcl/Tk Resources
Web and Intranet Resources
Web Application Deployment module A607
Apache httpd mod_rewrite
Exercises, examples and other material relating to training module A607. This module is presented on Private Courses and Specially Run Courses only

mod_rewrite turns the apache httpd web server from a file server into something much more powerful - it's used to point a whole directory of URLs at a single script, to correct URLs, and to forward specific requests. It's got further uses in load balancing too.
Related technical and longer articles
Making all your .html files run a Perl script
Load Balancing and Clustering
The proxy jServ, jk, jk2, warp and jk story

Articles and tips on this subjectupdated
1954mod_rewrite for newcomers
What is mod_rewrite? It's an Apache httpd (web server) module that takes user's requests for pages and diverts them to a resource of a different name (and perhaps type). Why might we want to do this? See previous article for some reasons and alternatives Here's a simple example of a rewrite rule: RewriteRule ...
3862Forwarding a whole domain, except for a few directories - Apache http server
I was set a puzzle via email last week - how to redirect an entire domain to a new server / domain, apart from three specific directories / folders which are to remain on the old server. Clearly, this is a task for mod_rewrite, and the natural and instrincive reaction is to write a regular expression ...
3753Adding a passcode to a directory
Scenario - I wanted to provide an easy download link that can be used to circulate a number of documents to people on a maiing list, with them able to pick and choose which they read. Don't want them to have to login / give passwords, but do want to be able to make it something more than just a simple ...
3568Telling which ServerAlias your visitor used - useful during merging domains
Someone tells you a website to visit - "go to wellhousemanor.co.uk" they say. And you'll naturally add "www." in front of it, calling up www.wellhousemanor.co.uk rather than wellhousemanor.co.uk ... or perhaps you won't. Web servers are normally set up by default to respond to a single specific host ...
3339Simplest ever proxy configuration?
Scenario ... Apache Http Server fronting an Apache Tomcat server. Http Server has mod_rewrite and mod_proxy installed. When we first did httpd and Tomcat courses, getting the two to talk to each other involved builds of extra modules and all sorts of configuration. I did my "simplest ever" this ...
3197Finding and diverting image requests from rogue domains
Search engines search images as well as text these days - and our images are often picked up because we're "good boys" and label them with alt attributes. Good - that helps generate traffic. However, there are some image search engines which have a tendency to be used for, and to feed out, adult material, ...
2900Redirecting a page - silent, temporary or permanent?
To 301 or not to 301 ... that is the question. Whether 'tis better to quietly redirect your users to a new page through mod_rewrite, or to instruct them to look elsewhere - Darren Shakespeare - 2003 ;-) In all seriousness - what should you do when someone arrives at your web site looking for a URL that ...
2981How to set up short and meaningfull alternative URLs
Wouldn't it be nice is URLs were shorter? Well - there are ways of making them shorter these days and you'll find them on networking sites like Twitter ... http://bit.ly/d7t8ID or http://bbc.in/XTQ8V . But where such URLs gain in brevity, they loose in comprehensibility. But it's very easy to provide ...
1731Apache httpd, MySQL, PHP - installation procedure
If you're installing LAMP (Linux, Apache, MySQL, PHP), what do you do and in which order? Here's a summary of the procedure we followed on todays Apache httpd deployment course - in this case running (tailored) for a single company audience, and tailored for specfic needs. (I've documented this and ...
2773Dynamically watching your web site via a PHP wrapper
On our web site, we "wrap" all of our pages in a PHP shell, which allows us to reference extra information easily within any of our pages, provide up to date course and hotel data on every page, and keep a dynamic log of current visitors in a database. The wrapper is applied through Apache http server ...
2768Carrying a long URL around - looking for memorable shorts
Are you sometime envious of nice, short URLs - you want to pass on a really short URL to someone, but the structure of your site is such that the resource in question has some long string associated with it - it has to carry a lot af "context" around with it ... There are services such as tinyurl available ...
2728Redirecting a home page using mod_rewrite
RewriteEngine On RewriteRule ^$ /community/index.php [R,L] Subject line says it all, really ;-) ... I've had some experimental stuff (with Joomla) on the "Transwilts Community Rail Partnership" site for a couple of weeks ... but at yesterdays very successful meeting of the working group, we decided ...
It's incredible just how much time bookkeeping takes - small adjustments to the various resources we have, tidying up modules that are no longer relevant and pointing any visitors at replacements. There' been a lot of that going on over the last couple of days ... for example: 1. I have deleted two ...
2094If you have a spelling mistake in your URL / page name
What do I do if someone reports a spelling mistake on one of our pages? I check that they're right (OK - I usually know straight away that they ARE as I'm one of the world's worst spellers and often distort one word into another valid word), and fix the page. And drop them a brief "thank you" of course. ...
1006Apache httpd and Apache Tomcat together tips
Many sites run two web servers - Apache httpd is ideal for plain HTML documents and scripts / programs that are single pages, run rarely, not all linked in together. Whereas Tomcat is an application container that suits applications that are run by tens of people all at the same time - great for banking, ...
1778Pointing all the web pages in a directory at a database
Do you want a web directory of pages, where each of them has its own page name (URL), but there isn't really a separate page for you to maintain - all the data is held in some sort of database on your server, and the pages are created automatically from the data as they're requested? You can do this ...
1771More HowTo diagrams - MySQL, Tomcat and Java
Here are some more diagrams "off the wall" from last week - showing "howto" and "whatis" information for Tomcat, Java and MySQL Some Tomcat and Java Fundamentals On the right of the board ... the main java programs ... • the Java compiler is called javac • the Java Virtual machins is in a ...
1636What to do if the Home Page is missing
The Web Server Administrator has two choices as to what he / she should do when a content provider doesn't supply a home page (index.html or similar) in a directory - either he can generate an error such as a 403 ("Forbidden") or 404 ("Not found"), or he can generate a directory listing, so that the ...
1376Choosing between mod_proxy and mod_rewrite
If you're connecting an Apache httpd server to an Apache Tomcat server, you can do so via proxied http requests - i.e. have your customer facing http server relay the request on, perhaps having modified it, to Tomcat and then passing the response back. Two different Apache modules give you the facility ...
1381Using a MySQL database to control mod_rewrite via PHP
Question: How can I set up Apache httpd / mod_proxy to use a program rather that a list of URL patterns to control my rewrites? Specify a rewrite map type prg in your httpd.conf or .htaccess file. For example: RewriteEngine On RewriteMap tryme prg:/home/trainee/website/andy RewriteRule (.*\.htm) ${tryme:$1} Question: ...
1207Simple but effective use of mod_rewrite (Apache httpd)
[Index under mod_rewrite tutorial] Do you want a single 'intelligent' web page to provide the content for tens or hundreds of URLs so that you don't have to write each similar page individually? Do you want to set up your server so that it will take any requests for ".htm" files and turn them into ".html"s? ...
1009Passing GET parameters through Apache mod_rewrite
If you're using Apache mod_rewrite to redirect a series of URLs to a single script, did you know that you can pass values entered onto a form via the GET method through as well? Simply add on %{QUERY_STRING} onto the end of your new URL. You'll need to add a ? into the target URL to ensure that the ...
934Clustering, load balancing, mod_rewrite and mod_proxy
"It's not friendly - it's like a reference book". Customer comment on yesterday's tailored training day, where we were load balancing a web application between a number of back end servers, using Apache httpd, with mod_proxy and mod_rewrite to do the clever bits. Our customers are right - it IS tough ...
755Using different URLs to navigate around a single script
1. I want my website to have different URLs for each of my content pages so that users can easily bookmark pages, pass them on to friends and contacts easily and with confidence, and search engines can register and handle each as its own distinct page but 2. I want most of the pages on my website to ...
631Apache httpd to Tomcat - jk v proxy
Many of our customers run both the Apache httpd and Apache Tomcat web servers - with good cause, since Tomcat is biased towards web applications where the same code is run many, many times over and httpd is biased towards serving pages and is better tuned for a much larger number of different pages but ...
Background information
Some modules are available for download as a sample of our material or under an Open Training Notes License for free download from [here].
Topics covered in this module
RewriteEngine, RewriteCond and RewriteRule.
Regular Expressions as used in mod_rewrite.
Passing GET parameters through mod_rewrite.
Configuring via httpd.conf and .htaccess.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule page.

Well House Consultants specialise in training courses in Linux and LAMP,Ruby, Lua, Python, Perl, PHP, and MySQL. We run Private Courses throughout the UK (and beyond for longer courses), and Public Courses at our training centre in Melksham, Wiltshire, England. It's surprisingly cost effective to come on our public courses - even if you live in a different country or continent to us.

We have a technical library of over 700 books on the subjects on which we teach. These books are available for reference at our training centre.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/A607.html • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb