Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite not working in all directories

         

zmsan

8:35 am on Feb 2, 2007 (gmt 0)

10+ Year Member



Hello,

In the 1.X version of Apache these rules worked fine. I am trying to execute a rule as follows:

RewriteCond %{HTTP_HOST}!^www\.domain\.com [NC]
RewriteRule (.*) [domain.com...] [R=301,L]

In httpd.conf I have added the following:

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

The strange thing that is happening is that when I go to domain.com it IS forwarded to www.domain.com. However, when I go to domain.com/fox/ it DOES NOT forward to www.domain.com/fox/

Before, I only had to add the file to the root directory (public_html) and it worked for all sub-directories. However, not now. Am I missing something?

Thanks!

jdMorgan

2:09 pm on Feb 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See RewriteOptions inherit in mod_rewrite

Jim

zmsan

12:23 am on Feb 3, 2007 (gmt 0)

10+ Year Member



I'm sorry... could you explain further? I really do appreciate it!

jdMorgan

12:29 am on Feb 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes. Click here [httpd.apache.org].

This option is likely set on your old server, but has not been set on your new server.

Jim

zmsan

1:01 am on Feb 3, 2007 (gmt 0)

10+ Year Member



Very strange... in the old httpd.conf I did a search for rewriteoptions and found nothing.

I put RewriteOptions inherit in the Virtual Host section for this site and it did nothing. What do you think? In 1.3X was it automatic that sub-directories inherited their parents .htaccess rules? This is how it worked on my server and I don't see anything in httpd.conf or individual htaccess files that addresses the RewriteOptions rule.

Maybe I am missing a .conf file somewhere? Hmmm..

jdMorgan

2:13 am on Feb 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also note in the "Override" requirement for RewriteOptions that "FileInfo" is required, and you've got "None" in your .conf file.

Jim

zmsan

8:07 am on Feb 3, 2007 (gmt 0)

10+ Year Member



Actually I have the following:

<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

This actually has no affect. So I leave this in somewhere towards the top or middle of httpd.conf and then I leave the other directive (RewriteOptions inherit) in the virtual host part for this site. And still, sub-directories do not re-direct. Very strange. Is there something that needs to be added to the sub-directory htaccess?

When I add the following to httpd.conf:

<Directory /home/*/public_html>
Options FollowSymLinks
AllowOverride FileInfo
</Directory>

I get a 500 error from the server.

I am not an idiot I promise. However, this is very strange to me.

zmsan

7:11 am on Feb 4, 2007 (gmt 0)

10+ Year Member



Any ideas?

jdMorgan

4:32 pm on Feb 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What do you see in the server error log when you get the 500-Server Error?

Jim

zmsan

9:00 pm on Feb 4, 2007 (gmt 0)

10+ Year Member



I get this, I believe:

[Sat Feb 03 02:10:25 2007] [alert] /home/domain/public_html/.htaccess: Options not allowed here

coopster

1:47 am on Feb 5, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Then you have a per-directory override file (
.htaccess
) in your directory (
/home/domain/public_html
) and you have not allowed
Options
to be overridden [httpd.apache.org].