SitePoint Sponsor |
|
User Tag List
Results 1 to 11 of 11
-
Apr 9, 2005, 05:11 #1
- Join Date
- Apr 2005
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
redirection in apache going into endless loops
Hi
I have RedHat 9 with apache installed my redirection for the website works fine. Now I have installed RHEL 4 with apache with the same httpd.conf config
and when i enter the username and password it goes into endless loops
this is the RedirectCode
RewriteEngine on
RewriteRule ^/$ /en/index.php [R]
# First change /en or /ar into /en/ and /ar/
#RewriteRule ^/(en|ar)$ /$1/ [R]
# Next add the index.php to URLs ending in /
RewriteRule ^(.*)/$ $1/index.php [R]
RewriteRule (.*)/member/cgi-bin/(.*) $1/cgi-bin/member/$2
RewriteRule ^/(en|ar)/cgi-bin/(.*)$ /cgi-bin/$2/$1 [T=application/x-httpd-cgi]
RewriteCond %{DOCUMENT_ROOT}/$2.$1.$3 -s
RewriteRule ^/(en|ar)/(.*)\.([a-z0-9]*)$ /$2.$1.$3
RewriteCond %{DOCUMENT_ROOT}/$2.$3 -s
RewriteRule ^/(en|ar)/(.*)\.([a-z0-9]*)$ /$2.$3
RewriteCond %{DOCUMENT_ROOT}/$2/index.$1.php3 -s
RewriteRule ^/(en|ar)/(.*)/index.php$ /$2/index.$1.php
RewriteCond %{DOCUMENT_ROOT}/$2/index.php3 -s
RewriteRule ^/(en|ar)/(.*)/index.php$ /$2/index.php
##RewriteRule ^/(en|ar)/(.*)/index.php$ /$2
/
##RewriteMap usage-map prg:/usr/local/var/kse/cgi-bin/member/usage
RewriteLog /etc/httpd/logs/rewrite_log
RewriteLogLevel 0
LogLevel debug
HostNameLookups off
</VirtualHost>
-
Apr 9, 2005, 05:45 #2
- Join Date
- Feb 2002
- Location
- Auckland
- Posts
- 14,692
- Mentioned
- 20 Post(s)
- Tagged
- 3 Thread(s)
yesrkay,
Okay, I don't know whether to claim that I'm a novice or that your regex is faulty but I've NEVER seen $n in regex before (not to mention other oddities). Since I deal with mod_rewrite redirections and the best place for those is in an .htaccess file, "compiling" them in to Apache on start with httpd.conf seems the hard way to do things.
While pippo or Mike may understand what you're trying to do, I don't. Would you please explain? I guess, the comments SHOULD be self explanatory (they're not logical to me -- my problem or the late hour) but what username and password are talking about that causes the loop?
Regards,
DKDavid K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
-
Apr 9, 2005, 06:21 #3
- Join Date
- Apr 2005
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
DK
The website is live.q8stocks.com.kw.
U have an english and arabic interface using redirection
The user has to login in this screen
At present the configuration is running on RH9 ,but now we are going for an upgradation to RHEL 4.
This redirect code works fine in RH9 allowing the user to login
but in RHEL4 the same redirect code goes into endless loops
This code was written by one of my colleague who has left the company long time back and I am a novice in redirection.
-
Apr 9, 2005, 06:30 #4
- Join Date
- Mar 2003
- Location
- England, UK
- Posts
- 2,906
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by dklynn
I remember reading pippo expain this a while ago.l
-
Apr 9, 2005, 06:54 #5
- Join Date
- Feb 2002
- Location
- Auckland
- Posts
- 14,692
- Mentioned
- 20 Post(s)
- Tagged
- 3 Thread(s)
yesrkay,
Hmmm, very confusing!
May I suggest that the redirections be removed from the httpd.conf until they can be corrected - put these rules in the .htaccess file in your root directory so you can change them without having to restart Apache.
Code:RewriteEngine on # redirect to english as default RewriteRule ^$ /en/index.php [R] # First change /en or /ar into /en/ and /ar/ #RewriteRule ^/(en|ar)$ /$1/ [R] # Next add the index.php to URLs ending in / # This SHOULD be handled in the httpd.conf as # DirectoryIndex index.html index.html.var index.php index.php3 index.phtml RewriteRule ^(.*)/$ $1/index.php [R] # handle cgi-bin calls RewriteRule (.*)/member/cgi-bin/(.*) $1/cgi-bin/member/$2 RewriteRule ^(en|ar)/cgi-bin/(.*)$ /cgi-bin/$2/$1 [T=application/x-httpd-cgi] # UNDEFINED VARIABLES - commented out # RewriteCond %{DOCUMENT_ROOT}/$2.$1.$3 -s RewriteRule ^/(en|ar)/(.*)\.([a-z0-9]*)$ /$2.$1.$3 # may use variables from prior rule RewriteCond %{DOCUMENT_ROOT}/$2.$3 -s # * should probably be + to require at least one letter/digit RewriteRule ^(en|ar)/(.*)\.([a-z0-9]*)$ /$2.$3 # may use variables from prior rule - php3??? That's got to be an OLD file! RewriteCond %{DOCUMENT_ROOT}/$2/index.$1.php3 -s RewriteRule ^(en|ar)/(.*)/index.php$ /$2/index.$1.php #ditto RewriteCond %{DOCUMENT_ROOT}/$2/index.php3 -s RewriteRule ^/(en|ar)/(.*)/index.php$ /$2/index.php
May I respectfully suggest that you do through the site and determine what redirects are actually required so the need for them can be specified (and accurate code written)?
Regards,
DKDavid K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
-
Apr 9, 2005, 10:52 #6
- Join Date
- Apr 2005
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
DK
The solution u suggested did not work. I still get endless loops
-
Apr 9, 2005, 14:18 #7
- Join Date
- Feb 2002
- Location
- Auckland
- Posts
- 14,692
- Mentioned
- 20 Post(s)
- Tagged
- 3 Thread(s)
yesrkay,
Originally Posted by dklynn
Regards,
DKDavid K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
-
Apr 10, 2005, 06:18 #8
- Join Date
- Apr 2005
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
DK
The site has two interface arabic and english
the default redirection goes to the english page
The user logs in a perl scripts runs from cgi-bin authenticating the user and returns back to the orignal page showing the user name in place of the login screen.
With RHEL 4 the user is able to login but the process goes into loop
-
Apr 10, 2005, 14:38 #9
- Join Date
- Feb 2002
- Location
- Auckland
- Posts
- 14,692
- Mentioned
- 20 Post(s)
- Tagged
- 3 Thread(s)
yesrkay,
Thank you, the "interfaces" explains the two directories.
Your further description suggests that either your PERL script is not setting the SESSION variables correctly, your SESSION storage on the site has changed without the settings being updated (httpd.conf under SESSIONS) or that your original script isn't properly handling the SESSION information set by PERL.
The most likely is the second option. If you're using a db to store SESSION information (for verification of user access), it's likely that the db location's been changed and that needs to be updated in the PERL script AND the original script. The original script should also be looking for an HTTP_REFERER in addition to the SESSION info so that should also be checked.
I hope these suggestions point you in the right direction.
Regards,
DKDavid K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
-
Apr 13, 2005, 00:26 #10
- Join Date
- Apr 2005
- Posts
- 5
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
DK
The problem was not with the redirection but one of the perl files. There was some problem with the copying and the files was trying to contact the database
server and going in to an infinite loop
neways thanks for your help and now have learnt a lot about redirection
-
Apr 13, 2005, 00:42 #11
- Join Date
- Feb 2002
- Location
- Auckland
- Posts
- 14,692
- Mentioned
- 20 Post(s)
- Tagged
- 3 Thread(s)
yesrkay,
Well, we accomplished something, then, didn't we! Horray!
Regards,
DKDavid K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Bookmarks