LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-25-2009, 04:53 PM   #1
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Rep: Reputation: 20
Apache redirect results in endless loop


I want to have requests to http://my.server/directory1/ wind up displaying http://my.server/directory1/test.xsd I tried adding test.xsd to DirectoryIndex in httpd.conf, but that didn't work. I tried adding test.xsd to DirectoryIndex in php.conf but that didn't work, either. I tried a Redirect in httpd.conf that said:

Redirect /directory1 http://my.server/directory1/test.xsd

which resulted in a URL of http://my.server/directory1/test.xsd...t.xsd/test.xsd

and one in .htaccess in directory1/ that said:

Redirect / http://my.server/directory1/test.xsd

But that winds up with my browser trying to access http://my.server/directory1/test.xsd...tory1/test.xsd

and:

Redirect Loop

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.



What do I need to do to make this work?
 
Old 03-25-2009, 05:07 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Either percevier with the DocumentIndex angle, or just add an index.html to contain a meta refresh to redirect to it that way.
 
Old 03-25-2009, 06:06 PM   #3
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Quote:
Originally Posted by jnojr View Post
Redirect only does simple prefix matching, so it can't be used to redirect a URL that starts with /directory1 as it would tell the browser to make a new request at the correct URL, but then it would redirect that — resulting in your loop.

You need a redirect rule that matches the exact path; I'd use RedirectMatch, which is similar to Redirect but matches on Regular Expressions:

Code:
RedirectMatch /directory1/?$ http://my.server/directory1/test.xsd
The ? makes the ending / optional (to redirect both /directory1 and /directory1/), and the $ means to match the end of the string.

For details on RedirectMatch, see http://httpd.apache.org/docs/1.3/mod...#redirectmatch

Hope that helps,

—Robert J Lee
 
Old 03-25-2009, 08:14 PM   #4
grizly
Member
 
Registered: Nov 2006
Location: Melbourne Australia
Distribution: Centos, RHEL, Debian, Ubuntu, Mint
Posts: 128

Rep: Reputation: 16
Try this in your .htaccess

AddType text/html .xsd
DirectoryIndex file.xsd

<Files .htaccess>
order allow,deny
deny from all
</Files>

http://httpd.apache.org/docs/2.2/howto/htaccess.html

Make sure you have http://httpd.apache.org/docs/2.2/mod...#allowoverride set correctly. (Its probably denied globally (for performance) so you need to allow htaccess files, check your logs for any errors, apache is usually very helpful!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
x keeps restarting in endless loop eggbert74 Linux - Newbie 17 08-29-2008 01:38 AM
FC2 startx endless loop zimzam Fedora 5 08-01-2005 01:02 PM
Hotplug endless loop AzCoder Ubuntu 4 04-30-2005 01:56 PM
Bizarre endless login loop CelticWhisper Slackware 6 04-06-2005 06:39 PM
HELP- endless loop contrasutra Linux - Software 2 04-26-2003 11:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration