l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
September 15: Scratch: programming for children and other not-yet-programmers
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2009 Apr 22 11:13

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Question related to Apache mod_rewrite and regularexpressions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Question related to Apache mod_rewrite and regularexpressions



Dave,

You might take a look at Django. It does url rewriting automatically, not
sure how though. It may be worth a look, especially the test application
listed below. Kyle Ambroff gave a great presentation on Django a couple
years back at an ACM meeting at Sac State. Maybe we could twist his
arm into giving one at Lugod. I definitely intend to configure a django
server, probably after this semester is over though. ;-)

I see several Django books on Safari.
http://proquest.safaribooksonline.com

Python Web Development with DjangoŽ 
By: Jeff Forcier; Paul Bissex; Wesley Chun

Sams Teach Yourself Django in 24 Hours
By: Brad Dayley

The Definitive Guide to Django: Web Development Done Right
By: Adrian Holovaty; Jacob Kaplan-Moss


Excerpted from the following book on Chapter 4.
An Introduction to Testing Web Applications with twill and Selenium
by C. Titus Brown; Gheorghe Gheorghiu; Jason Huggins

4.1.1. Installing and running the poll application

   1.

      Install Django (see (http://www.djangoproject.com/documentation/install/)).
   2.

      Download the demonstration app, at (http://webtesting.idyll.org/resources/django-poll.zip).
   3.

      Unpack django-poll.zip (it will unpack into a subdirectory named django-poll) and change into the mysite sub-directory.
   4.

      Run python manage.py runserver. It will start a web server on http://localhost:8000; to make sure that it is running, visit http://localhost:8000/polls.


brian

On Tue, Apr 21, 2009 at 10:14:45AM -0700, David Spencer, Internet Handyman wrote:
> Harold, that worked perfectly! Thanks so much!!
> 
> In looking at the results, I was wondering if it's possible to "hide"
> the resulting URL for SEO purposes? In other words, when the link is
> to product-Another-Thing.php, the URL changes internally to
> product.php?name=Another-Thing but it doesn't update in the location
> string. I've slogged about with it this morning, but as usual, all
> I've managed to do is break it. Any further ideas?
> 
> Thanks again,
> 
> 
> -- Dave Spencer, PageWeavers
> 
> On Mon, Apr 20, 2009 at 3:36 PM, David Spencer <spencer@pageweavers.com>wrote:
> 
> > I've killed the better part of the morning and this afternon trying to
> > figure out this use of Apache's mod_rewrite.
> 
> 
> Welcome to mod_rewrite. There's a logging facility that can create a log of
> which rules were tried, but it doesn't help in this case where you only have
> one rule.
> 
> 
> > RewriteEngine On
> > RewriteRule ^/?product-([A-Za-z0-9-]+)\.php$ product.php?name=$1 [ R=301,L]
> >
> 
> You did a gread job here, but ...
> 
> 1) No spaces in the [] at the end of the line, so you want [R=301,L]
> 
> 2) I found I needed to add this option also:
> Options +SymLinksIfOwnerMatch
> 
> 3) You almost certainly also want QSA (query string append), making it
> [R=301,L,QSA] at the end of the line. This will add the name parameter to
> whatever other parameters were sent, instead of dropping the original
> parameters:
> 
>     product-a.php?quantity=4 -> product.php?name=a&quantity=4
> 
> You can check Apache's error_log if this still isn't working for hints.
> 
> Harold
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech

-- 
Brian Lavender
http://www.brie.com/brian/
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.