Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite & WebGUI & Apache 2 & .htaccess

issues issues issues

         

moltar

5:41 pm on Mar 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've transfered a website from a virtual hosting to a dedicated hosting. Old hosting had Apache 1.x running and cpanel. New one is running Apache 2 and Plesk.

I started having issues right away. For some reason .htaccess files don't work well. Right when I declare RewriteEngine on it gives me 403 error.

I've tried puting the code into a config file directly. Rewrite engine seems to work, but does not rewrite anything. The code used to work on the old server no problem for past year.

Did anyone experience the same problems?

closed

3:58 am on Mar 17, 2004 (gmt 0)

10+ Year Member



Rewrite engine seems to work, but does not rewrite anything.

Dunno. Maybe mod_rewrite isn't enabled? If mod_rewrite works, you should be able to rewrite.

moltar

6:48 am on Mar 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is way too complicated. But here it goes.

Server has Apache 2, Plesk 7 cp, and SuExec installed.

Main httpd.conf file:

<Directory /> 
Options All
AllowOverride All
</Directory

Local to the account httpd.include file:

<VirtualHost 12.34.56.789:80> 
ServerName widgets.com:80
ServerAlias www.widgets.com
UseCanonicalName Off
SuexecUserGroup username psacln
ServerAdmin "webmaster@widgets.com"
DocumentRoot /home/httpd/vhosts/widgets.com/httpdocs
CustomLog /home/httpd/vhosts/widgets.com/statistics/logs/access_log combined
ErrorLog /home/httpd/vhosts/widgets.com/statistics/logs/error_log
<IfModule mod_userdir.c>
UserDir /home/httpd/vhosts/widgets.com/web_users
</IfModule>
ScriptAlias /cgi-bin/ /home/httpd/vhosts/widgets.com/cgi-bin/
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /home/httpd/vhosts/widgets.com/httpdocs>
<IfModule mod_perl.c>
<Files ~ (\.pl)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_value open_basedir "/home/httpd/vhosts/widgets.com/httpdocs:/tmp"
</IfModule>
Options +Includes +ExecCGI
</Directory>
Alias "/error_docs" "/home/httpd/vhosts/widgets.com/error_docs"
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html
</VirtualHost>

If any, even the most simple mod_rewrite rule is ran, I get an error in the browser:

Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.

Log says:

Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden:

I suspect it to be the SuExec messing things up, but have no idea what to do to fix it.

I've tried both methods: using .htaccess file and putting the code directly into vhost.conf file - no luck.

closed

2:40 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden

And you've tried putting

Options +FollowSymLinks
before any occurrences of
RewriteEngine on
?

moltar

4:44 pm on Mar 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, I forgot to add, my httpd.conf actually reads:

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

closed

6:21 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



+FollowSymLinks
is redundant in that case.

Have you tried adding

+FollowSymLinks
to this line in your
<Directory /home/httpd/vhosts/widgets.com/httpdocs>
:

Options +Includes +ExecCGI

moltar

6:47 pm on Mar 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, I've tried that too. I've also tried it now again. I added it right below <Directory /> in httpd.config and restarted the server. It doesn't work.

The thing is, just saying "RewriteEngine On" without even any rules give the error message right away!

closed

8:41 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



Hmmm...that's strange. Must be something wrong with how mod_rewrite is configured.

If you haven't enabled mod_rewrite, you'll get an message like this in your error log when you just have

RewriteEngine on
in your .htaccess:

Invalid command 'RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration

Unfortunately, I get a 500 error, not a 403 like you do.

So I don't really know how to help you with your problem.

moltar

10:07 pm on Mar 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_rewrite is definetely on, it even does the rewrite I think (I can see it's logs), but I think problem might be not even in mod_rewrite itself.

The way I see it now: SuEXEC blocks any sort of links withing the system. And when you rewrite it to a not existing file, it thinks it's a link and refuses it. That is just imo...