Mailinglist Archive: opensuse (1425 mails)

< Previous Next >
Re: [opensuse] apache mod_rewrite
  • From: "David C. Rankin, J.D.,P.E." <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Sun, 3 May 2009 03:15:24 -0500
  • Message-id: <200905030315.24977.drankinatty@xxxxxxxxxxxxxxxxxx>
On Saturday 02 May 2009 20:10:31 Duaine & Laura Hechler wrote:
Where do I turn this on ? And how do I verify it's on ?

Please give details.

Thanks, Duaine

--

Duaine,

First in Yast -> Sysconfig Editor; then to Network -> Apache2; then
look at
the loaded modules list. Just modify the list by adding 'rewrite' to the list
and you will have it enabled. Then here is how I make use of it for rewriting
urls to force https for any connections that isn't on my lan.

Basically, you can see within the following httpd.conf.local directory
designation I begin the rewrite check with <IfModule mod_rewrite.c> which
just says in English "If mod_rewrite is enabled, then do the following
tricks"

Then just turn the rewrite engine on, Set the rewrite base to the root
/ and
use regular expression syntaxt to "catch" and "rewrite" the urls the way you
desire.

Here we just compare the remote address to my lan address and then set
the
conditiond that if it "ain't local", turn than damn fancy stuff on, because
I'm going to make you use passwords! So it just takes the url and rewrites it
to access my site via https instead of http so passwords are transferred over
a secure link.

There are a bizillion things you can do with mod_rewrite it has been
likened
to the swiss army knife of http.

<Directory "/srv/www/family">
Options +Indexes +FollowSymLinks
IndexOptions FancyIndexing IconsAreLinks FoldersFirst
AllowOverride AuthConfig Options FileInfo Limit
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^192\.168\.6\.
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
</IfModule>
AuthType Basic
AuthName "Restricted"
AuthBasicProvider dbm
AuthDBMType DB
AuthDBMUserFile /usr/local/lib/apache2/dcraccess
Require valid-user
Order allow,deny
Allow from 66.69.68.60
Satisfy Any
Deny from 4. 24. 60. 62.
</Directory>

The apache doc on mod_rewrite is very good.


--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
This Thread