LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Apache Migration/Compatibility > Redirect by rewrite & .htaccess

Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2007, 06:53 AM
slimak slimak is offline
Senior Member
 
Join Date: Aug 2006
Posts: 67
Default Redirect by rewrite & .htaccess

Hello,
When LSWS redirect from one catalog to another, it doesn't check the .htaccess in new directory. e.g.: I have catalog /a/ with .htaccess file. In /a/.htaccess I use mod_rewrite to redirect from /a/info.php to /b/info.php. In catalog /b/ I have .htaccess file with "php_value register_globals off". When I enter /a/info.php then I have register_globals on, but when I enter /b/info.php then the register_globals are off. In Apache register_globals are off for both /a/info.php & /b/info.php.
Reply With Quote
  #2  
Old 01-25-2007, 08:22 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
OK. I will check this.
Reply With Quote
  #3  
Old 01-25-2007, 09:11 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
It works properly with my test case. What is the rewrite rule to redirect /a/info.php to /b/info.php? I wonder if the request got redirected at all.

My rewrite rule in /a/.htaccess
Code:
RewriteEngine on
RewriteRule phpinfo.php /2/phpinfo.php
It performs an internal redirect which does not change the URL in browser, if external redirect is prefered, just add "[R]" to the end of the rewrite rule, same result.
Reply With Quote
  #4  
Old 01-26-2007, 04:14 AM
slimak slimak is offline
Senior Member
 
Join Date: Aug 2006
Posts: 67
Default Answer

I checked that and when you redirect from /a/phpinfo.php to /b/phpinfo.php it works, but when your redirect from /phpinfo.php (document_root) to /b/phpinfo.php it doesn't work.
I have files:
public_html/.htaccess:
RewriteEngine on
RewriteRule phpinfo.php /2/phpinfo.php

public_html/2/.htaccess:
php_value register_globals off

public_html/2/phpinfo.php:
<?php
phpinfo();
?>

There is no file public_html/phpinfo.php.
1. When I enter http://domain/phpinfo.php, then register_globals are on (wrong).
2. When I enter http://domain/2/phpinfo.php, then register_globals are off (correct).
3. When I enter http://domain/empty_dir/phpinfo.php, then register_globals are off (correct).
Reply With Quote
  #5  
Old 01-26-2007, 10:04 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
please try the 3.0 package
http://www.litespeedtech.com/package...6-linux.tar.gz

Frontpage with domain.com may work well with this release as well, please let me know.
Reply With Quote
  #6  
Old 01-27-2007, 02:17 AM
slimak slimak is offline
Senior Member
 
Join Date: Aug 2006
Posts: 67
Default Answer

1. Now .htaccess after redirect works.
2. FrontPage Ext with domain.com still doesn't work. When I copy file /usr/local/frontpage/www.domain.com:80 to /usr/local/frontpage/domain.com:80, then they works.
3. In new version, when I enter LSWS "Control Panel", I have error:
Warning: Invalid argument supplied for foreach() in /usr/local/lsws/admin/html.3.0/classes/ws/Service.php on line 59
Reply With Quote
  #7  
Old 01-27-2007, 06:59 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
For #2, it is a work around as expected. I just wonder why Apache can do it without domain.com:80? I thought it was "UseCanonicalName on", so CGI env SERVER_NAME will be always set to "www.domain.com" when accessed through http://doamin.com/... , and I just added support for UseCanonicalName in LSWS, I wonder why it still does not working.

We saw #3 problem surfacing sometimes as well, no real harm, but will let web admin developer to take a look. Thanks.
Reply With Quote
  #8  
Old 01-28-2007, 03:01 AM
slimak slimak is offline
Senior Member
 
Join Date: Aug 2006
Posts: 67
Default Answer

#2. I have "UseCanonicalName off" for all VH. When I turned it on for one virtual host, then it was working properly (www.domain.com and domain.com). It seems that Apache force UseCanonicalName off for FrontPage Extensions.
Reply With Quote
  #9  
Old 01-28-2007, 10:58 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I see. I updated the package to force "UseCanonicalName on" for FrontPage Extensions. Please give it a try.

Thanks.
Reply With Quote
  #10  
Old 01-30-2007, 08:16 AM
slimak slimak is offline
Senior Member
 
Join Date: Aug 2006
Posts: 67
Default Answer

Now FrontPage Extensions works perfectly at LSWS.

To make it work at cPanel server, admin must execute two shell commands:

Quote:
sed -rie 's/(safe_)?chmod\(( )?0600,( )?("\$\{myuid\}",)?( )?"\$(\{)?homedir(\})?\/public_html\$\{subweb\}\/_vti_pvt\/service.pwd"( )?\);/\1chmod(\20644,\3\4\5"$\6homedir\7\/public_html${subweb}\/_vti_pvt\/service.pwd"\8);/' /scripts/fp-auth /usr/local/frontpage/version5.0/apache-fp/fp-auth /usr/local/cpanel/bin/convertfppassthrough /scripts/fixfrontpageperm
Quote:
/scripts/fixfrontpageperm
Reply With Quote
Reply

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


All times are GMT -7. The time now is 08:41 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.