You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by tomcatastrophe <na...@changethings.org> on 2009/06/30 03:51:40 UTC

[users@httpd] mod_rewrite on Windows with Apache 2.2

I have Apache 2.2 working perfectly on my Linux installation and now I am
trying to set up a copy on my Windows box for development.

Everything works fine except rewriting of URLs.

I have searched and searched online, but every guide and forum says
something different. The information is poorly organized and I can't seem to
find a simple answer.

Here is the basic problem:

I have installed Apache 2.2 for Windows with the default configuration,
nothing fancy. I set up some virtual hosts, they are detected and work fine.
I can view my pages, etc.

Now I want to add URL rewriting for one of my hosts.

I added my rules and directive to the virtual host (these work fine on
Linux):

     ProxyPreserveHost On
     ProxyPassReverse / ajp://localhost:8009/
     RewriteEngine On
     RewriteRule ^/(.*)$ ajp://localhost:8009/$1 [P]

But when trying to start Apache after doing this I get an error that the
service failed to start.

So, I uncommented this line in my httpd.conf:

#LoadModule rewrite_module modules/mod_rewrite.so

But that didn't change anything. I still get the error and can't start
Apache when my directives are present.

I've read all over about .htaccess files, etc, but I don't have any
references to that in my httpd.conf other than this:

    # AllowOverride controls what directives may be placed in .htaccess
files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

I changed AllowOverride None to AllowOverride All but this also did not
allow Apache to start.

So, with a default installation of Apache 2.2 on Windows, what is the
simplest, most straight-forward way to enable URL rewriting to add the rules
I want?

Please don't send me to a bunch of links or guides online or the start page
for Apache's mod_rewrite section, I have this working fine on Linux, I just
need to know how to enable the exact same functionality on Windows. I've
been looking for hours now. :)

Thanks!
-- 
View this message in context: http://www.nabble.com/mod_rewrite-on-Windows-with-Apache-2.2-tp24261924p24261924.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on Windows with Apache 2.2

Posted by Jonathan Zuckerman <j....@gmail.com>.
On Mon, Jun 29, 2009 at 7:04 PM, Peter Kay<pe...@yahoo.com> wrote:
>
> ----- Original Message ----
>
>> From: tomcatastrophe <na...@changethings.org>
>> To: users@httpd.apache.org
>> Sent: Monday, June 29, 2009 9:51:40 PM
>> Subject: [users@httpd] mod_rewrite on Windows with Apache 2.2
>>
>>
>> I have Apache 2.2 working perfectly on my Linux installation and now I am
>> trying to set up a copy on my Windows box for development.
>>
>> Everything works fine except rewriting of URLs.
>>
>> I have searched and searched online, but every guide and forum says
>> something different. The information is poorly organized and I can't seem to
>> find a simple answer.
>>
>> Here is the basic problem:
>>
>> I have installed Apache 2.2 for Windows with the default configuration,
>> nothing fancy. I set up some virtual hosts, they are detected and work fine.
>> I can view my pages, etc.
>>
>> Now I want to add URL rewriting for one of my hosts.
>>
>> I added my rules and directive to the virtual host (these work fine on
>> Linux):
>>
>>      ProxyPreserveHost On
>>      ProxyPassReverse / ajp://localhost:8009/
>>      RewriteEngine On
>>      RewriteRule ^/(.*)$ ajp://localhost:8009/$1 [P]
>>
>> But when trying to start Apache after doing this I get an error that the
>> service failed to start.
>
>
> Did you check for a specific error in the Event Log?
>
> --Peter
>
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Don't know if this could be the problem (and it may even differ by
version/configuration), but for my own local webservers (apache 2.2.11
on ubuntu and whatever comes with  os x 10.5) the leading slash after
the ^ should not be used in the regex.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on Windows with Apache 2.2

Posted by Peter Kay <pe...@yahoo.com>.
----- Original Message ----

> From: tomcatastrophe <na...@changethings.org>
> To: users@httpd.apache.org
> Sent: Monday, June 29, 2009 9:51:40 PM
> Subject: [users@httpd] mod_rewrite on Windows with Apache 2.2
> 
> 
> I have Apache 2.2 working perfectly on my Linux installation and now I am
> trying to set up a copy on my Windows box for development.
> 
> Everything works fine except rewriting of URLs.
> 
> I have searched and searched online, but every guide and forum says
> something different. The information is poorly organized and I can't seem to
> find a simple answer.
> 
> Here is the basic problem:
> 
> I have installed Apache 2.2 for Windows with the default configuration,
> nothing fancy. I set up some virtual hosts, they are detected and work fine.
> I can view my pages, etc.
> 
> Now I want to add URL rewriting for one of my hosts.
> 
> I added my rules and directive to the virtual host (these work fine on
> Linux):
> 
>      ProxyPreserveHost On
>      ProxyPassReverse / ajp://localhost:8009/
>      RewriteEngine On
>      RewriteRule ^/(.*)$ ajp://localhost:8009/$1 [P]
> 
> But when trying to start Apache after doing this I get an error that the
> service failed to start.


Did you check for a specific error in the Event Log?

--Peter


      

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite on Windows with Apache 2.2

Posted by Bob Ionescu <bo...@googlemail.com>.
2009/6/30 tomcatastrophe <na...@changethings.org>:
> Now I want to add URL rewriting for one of my hosts.
>
> I added my rules and directive to the virtual host (these work fine on
> Linux):
>
>     ProxyPreserveHost On
>     ProxyPassReverse / ajp://localhost:8009/
>     RewriteEngine On
>     RewriteRule ^/(.*)$ ajp://localhost:8009/$1 [P]
>
> But when trying to start Apache after doing this I get an error that the
> service failed to start.

You don't want to use mod_rewrite for such a simple reverse proxy by
mod_proxy. Use the directive ProxyPass instead. You'll need mod_proxy
and mod_proxy_ajp (you'll need them as well if you're using
mod_rewrite).

ProxyPreserveHost On
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/

> I've read all over about .htaccess files, etc, but I don't have any

I thought we're talking about the main server configuration file
(httpd.conf) and not a per-directory configuration file?!

Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org