Re: mod_rewrite loaded, but not writing or logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



thank you. i got it working! joy!

i had tried the 'RewriteOptions Inherit' stuff as well, to no avail.

So, all i did to fix this was move my <vhost...> entries from the 'included' httpd-vhosts.conf file into the main httpd.conf file (and commented back out that 'vhosts' include line). I also had to bring over the 'NameVirtualHost *:80' directive, of course - something I didn't catch at first.

That's it. All is working great again. It's possible my main httpd.conf just got completely out of whack, but it kinda seems like something else is going on with that include file. I assumed it was just an organizational thing, but maybe not?

My rewrite rules are once again inside .htaccess files, where they are required to be for my host (GoDaddy) - but w/ my home setup, i could do any setup as long as i got it working.

So, for other n00bs, if you need virtual hosts (multiple websites), I'd suggest appending this to the bottom of your httpd.conf:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80


Then add at least one of these virtual host entries:

    <VirtualHost *:80>
        ServerName local.songsabout.net
        DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\vhosts\songsabout"

            <Directory "C:\Program Files\Apache Software Foundation\Apache2.2\vhosts\songsabout">
                Options Indexes FollowSymLinks
                #AllowOverride None
                AllowOverride All
                Order allow,deny
                Allow from all
            </Directory>
    </VirtualHost>


Then put a .htaccess in your '...\songsabout' directory (your root) and put in a rule that will definitely match all incoming URLs, then build from there:

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ http://cnn.com/ [R=301,L]




Vincent Bray <noodlet@xxxxxxxxx> wrote:
On 20/08/07, Peter Smith wrote:
> At this point, I'll be very happy with any rewriting of any sort - with
> virtual hosts or not - though, I'd eventually like to get it working with
> virtual hosts. Since I've destroyed my config files I'll probably start with
> a brand new Apache install (or at least a new httpd.conf), but here's what
> I've got right now in my httpd.conf in global context:
>
> RewriteEngine on
> RewriteLog c:\temp\rewrite.log
> RewriteLogLevel 7
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ http://cnn.com/ [R=301,L]
>
> The section for document_root is currently in its
> post-install form.
>
> My virtual host entry:
>
>
>
> ServerName local.songsabout.net
> DocumentRoot "C:/Program Files/Apache Software
> Foundation/Apache2.2/vhosts/songsabout"
>
>
> Foundation/Apache2.2/vhosts/songabout">
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
> Order allow,deny
> Allow from all
>

>


That's likely your problem. If you have vhosts, by default mod_rewrite
won't be inherited from the main context. You can fix that by putting:

RewriteEngine On
RewriteOptions Inherit

.. in the vhost, but really you'll be better off putting your rules in
the vhost.

However, if you just want to send 404 requests to an external URL see
ErrorDocument.
Also, see this page for why matching REQUEST_URI in this context won't work.

http://wiki.apache.org/httpd/RewriteContext


--
noodl


Got a little couch potato?
Check out fun summer activities for kids.
[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux