Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 23rd January 2012, 11:11
fmmarzoa fmmarzoa is offline
Junior Member
 
Join Date: Jan 2010
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default Problems with mod rewrite and existing directory

Hi,

I have two webservers, one for development with Ubuntu 11.10 and other for deployment with Ubuntu 10.04. Both runs apache with similar configuration, and the only relevant difference I think it is that deployment one uses ISPConfig 3, so I think my problem may be related with that (perhaps not, indeed...).

Well, I have in both servers the following .htaccess at website root directory:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]

As you may know, it tells to apache that if the requested filename is neither a file, nor a directory and not a symlink, it should redirect request to index.php.

It works as expected on my development site without ISPConfig 3, but it does NOT on my deployment one with it. The problem is that it redirects to index.php even a folder that yet exists.

So, I have an /admin folder there with the backend office of the site. In the development site if I do:

http://mydomain.com/admin/

It works as expected, but in deployment one it redirects to index.php as if it were not a directory. But the folder is there and it IS a directory without any doubt. So I think that mod rewrite directives may be failing for some reason, but what???

Thanks a lot in advance,
Reply With Quote
Sponsored Links
  #2  
Old 23rd January 2012, 11:21
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,476
Thanks: 813
Thanked 5,255 Times in 4,121 Posts
Default

The .htaccess file ahs to be in the "web" subdirectory of the website. Then check the permissions of your .htaccess file, it must be readable by the apache user. This ,eans that it is ether world readable or at least readable for the user and group when the user is the web user and the group is the client group of this website.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 23rd January 2012, 11:52
fmmarzoa fmmarzoa is offline
Junior Member
 
Join Date: Jan 2010
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default .htaccess is readable

Hi,

Thanks a lot by your answer, but .htaccess is on web subdir and it is readable, otherwise it will not be doing the redirection that it is doing.

Anyway:
-rw-r--r-- 1 web2 client2 295 2012-01-23 02:38 .htaccess

The problem is that those RewriteCond seems to be ignored by Apache, or for some reason it thinks that /admin is not a directory, or something similar.

One thing that it seems to be important is that /admin has its own .htaccess file and it is password protected. I did not think that this was relevant for the case, but I have found a guy with similar problems here:

http://stackoverflow.com/questions/1...in-mod-rewrite

See the answer Apr 19 '10 at 1:31 by matdumsa:

"RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

These conditions are already supposed not to rewrite the url of existing folders but they don’t do their job for password protected folders."

To do a fast test on this, I just removed the .htaccess file from /admin and after that the redirection works as expected, so the http://mysite.com/admin is working right. The problem is that I need that folder to be password protected, so now I must find a way to have that /admin/.htaccess file and RewriteCond working...

Best regards,
Reply With Quote
  #4  
Old 23rd January 2012, 12:09
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,476
Thanks: 813
Thanked 5,255 Times in 4,121 Posts
Default

Have you tried to add the password protection in the .htaccess file in the web directory e.g. inside of a directory directive before or after the rewrite?
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 23rd February 2012, 19:52
commentator commentator is offline
Senior Member
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 146
Thanks: 49
Thanked 7 Times in 5 Posts
 
Default

looks like this is the same problem as on my server:
http://www.howtoforge.com/forums/sho...55&postcount=4

Does it work when you change fast-cgi to mod-php ?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with emails server (postfix, courier, mysql and squirrelmail) cleber_maverick Server Operation 5 6th November 2011 12:11


All times are GMT +2. The time now is 21:38.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.