Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mod_Rewrite Problem

Status
Not open for further replies.

Arie1

Technical User
Feb 21, 2001
12
MT
Hi,

I use the following mod rewrite rules:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteLogLevel 0
RewriteCond %{HTTP_USER_AGENT} ^Bullseye.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^WebZIP/ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus.* [NC]
RewriteRule ^/.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} ^-?$
RewriteRule ^/.*$ /usr/local/etc/httpd/sites/infinisource.com/cgi-bin/noID.cgi [L,T=application/x-httpd-cgi]
RewriteCond %{HTTP_USER_AGENT} ^.*Ad.*Muncher.*v4.*.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*NetCaptor.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*WebWasher.* [NC]
RewriteRule ^/(.+) [L]
</IfModule>

This works perfect if used in the Virtual Host, but doesn't work at all when used in the server config. According to the Apache documents it should work in the server config (see: )

Does anybody have any info on this?
 
Arie1,
have you tried turning on the rewrite logging to see if it gives you some info?

joel
 
Well, after reading the documents again, I found out that you have to 'enable' mod_rewrite for every virtual host.

This is the code I use:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteOptions inherit
</IfModule>
 
Glad I &quot;poked&quot; your memory :eek:)
 
Hi,

I use the following mod rewrite rules:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteOptions inherit
RewriteRule ^/testkkl/([^/]+)/?(.*) /index.html </IfModule>

But it refuse to work !

What could be the problem ?

Thanxs





 
Hi,



On the last query - what might be missing is the 'LoadModule' entry in httpd.conf to load the actual dso module :



LoadModule rewrite_module modules/mod_rewrite.so



The relative directory for your may not be 'modules' - it could be 'libexec' for example. Just copy similar entries in your httpd.conf. Then do a 'killall -HUP httpd' to get apache to re-read its config.



Also, remember for name based hosts once you have them activated your default (original) site will not be served so the statements would only have a meaning within a virtual host container (assumes you have vhosts listening to all interfaces).



Hope this helps





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top