Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-25-2004, 11:16 PM   #1
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Rep: Reputation: 15
Mod_rewrite question

Hi all,
I load mod_rewrite on the httpd.conf file. Now, how do I test to see if it work correctly?

Old 02-25-2004, 11:55 PM   #2
Senior Member
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 65
Put in a rewrite rule in the httpd.conf file:

RewriteEngine on
ReWriteCond condition to match here
ReWriteRule what you wanna do here
Old 02-22-2006, 11:11 PM   #3
Registered: Mar 2003
Distribution: redhad 7.3
Posts: 42

Rep: Reputation: 15
where would be the right place?

I've always done Rewrite rules inside virtuls. but this box doesn't have (or need) any. so where do I put the rewrite rules? thanks.
Old 02-22-2006, 11:22 PM   #4
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,124

Rep: Reputation: 164Reputation: 164
One of the examples in the docs at has the following (I've removed the comments):
UseCanonicalName on
CustomLog  /path/to/access_log  "%{VHOST}e %h %l %u %t \"%r\" %>s %b"
RewriteEngine on
RewriteMap    lowercase    int:tolower
RewriteMap    vhost        txt:/path/to/
RewriteCond   %{REQUEST_URI}  !^/commonurl1/.*
In other words, in Section 2 of httpd.conf - the 'Main' server configuration.
Old 02-23-2006, 01:28 AM   #5
Registered: May 2004
Location: Vancouver, WA
Distribution: Mint, Debian, Slackware
Posts: 123

Rep: Reputation: 15
You can also throw them into an .htaccess file for easier editing access than in httpd.conf
Old 02-23-2006, 12:03 PM   #6
Registered: Mar 2003
Distribution: redhad 7.3
Posts: 42

Rep: Reputation: 15

I threw it into the <directory> it accepted the actual Rewrite rules and Rewrite on, but I had some rewrite log configurations and log level and it said they can't be there. and needless to say it did nt work.

I've always been told that putting it in the server conf is way more efficient, and also that .htaccess files are more error prone but I'm totally OK with using .htaccess on the dev box. For me it is much of a muchness. I own the colo server where there are virtuals, and the dev box where there arent.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite problem jfall Programming 1 02-22-2005 08:05 PM
mod_rewrite to allow only jimieee Linux - Security 2 06-08-2004 05:17 AM
Mod_Rewrite help in Apace 1.3... vrillusions Linux - Software 0 08-11-2003 10:18 PM
Apache (mod_rewrite) question Wonko the Sane Linux - Software 1 06-15-2003 01:55 PM
Enableing MOD_REWRITE prtynked General 0 04-01-2002 06:18 PM

All times are GMT -5. The time now is 10:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration