Problems with .htaccess rewrite and Ruby on Rails/RedmineApache RewriteRule for proxyingVirtualhost setup for Ruby on Rails application (mod passenger)Affordable combined Ruby/Rails/Redmine + Subversion hosting?how to enable redmine (ruby on rails) logging?Installing redmine on ubuntu 10.10Rails app (Redmine) on Phusion PassengerRuby on Rails (Redmine) on Apache - 503 ErrorApache2 Ruby on rails and Redmine changing the rail app urlapache rewrite rules, non-www, httpsWhere can I create or edit Nginx URL rewrite configuration file in Google App Engine?

UTC timestamp format for launch vehicles

Why was this person allowed to become Grand Maester?

Is it possible to fly backward if you have really strong headwind?

How to hide rifle during medieval town entrance inspection?

2019 gold coins to share

C++ logging library

A word that means "blending into a community too much"

Increase speed altering column on large table to NON NULL

Solving ‘Null geometry…’ error during distance matrix operation?

I have a problematic assistant manager, but I can't fire him

Can the removal of a duty-free sales trolley result in a measurable reduction in emissions?

bash vs. zsh: What are the practical differences?

What is the color of artificial intelligence?

Is it safe to change the harddrive power feature so that it never turns off?

What aircraft was used as Air Force One for the flight between Southampton and Shannon?

Why we don’t make use of the t-distribution for constructing a confidence interval for a proportion?

What STL algorithm can determine if exactly one item in a container satisfies a predicate?

Should I put programming books I wrote a few years ago on my resume?

How can I remove material from this wood beam?

What would be the way to say "just saying" in German? (Not the literal translation)

Why is Na5 not played in this line of the French Defense, Advance Variation?

Why are MBA programs closing in the United States?

Java Servlet & JSP simple login

Why do radiation hardened IC packages often have long leads?



Problems with .htaccess rewrite and Ruby on Rails/Redmine


Apache RewriteRule for proxyingVirtualhost setup for Ruby on Rails application (mod passenger)Affordable combined Ruby/Rails/Redmine + Subversion hosting?how to enable redmine (ruby on rails) logging?Installing redmine on ubuntu 10.10Rails app (Redmine) on Phusion PassengerRuby on Rails (Redmine) on Apache - 503 ErrorApache2 Ruby on rails and Redmine changing the rail app urlapache rewrite rules, non-www, httpsWhere can I create or edit Nginx URL rewrite configuration file in Google App Engine?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I installed Redmine and so far everything runs smoothly.



Now i want to add a rewrite rule via .htaccess in order to redirect requests from domain.tdl to www.domain.tdl.
This is approach works fine with my everyday php projects:



RewriteEngine On
RewriteBase /

# redirect all pages w/o www to www.
RewriteCond %HTTP_HOST !^www.domain.tdl$
RewriteRule ^(.*)$ http://www.domain.tdl/$1 [L,R=301]


However when i add this to our redmine/public/.htaccess it seems to redirect infinitely (resulting in a timeout/http 500 error).



I tried to look up forums/google for a solution but i only found thousands of contradictory opinions:



  • ruby on rails and .htaccess don't work together

  • ruby on rails and .htaccess DO work together

  • you have to edit your application controller

  • you have to edit your mongel config

  • and so forth...

Am I missing something? I'm not sure i want to edit my application controller and I'm quite certain I don't have access to any mongrel config (managed server hosting).










share|improve this question
























  • Take a look at the error log.

    – quanta
    Nov 7 '11 at 13:41











  • RewriteLog /tmp/rewrite.log and RewriteLogLevel 9 (which must be set in the server config) FTW!

    – Holger Just
    Nov 7 '11 at 23:01

















1















I installed Redmine and so far everything runs smoothly.



Now i want to add a rewrite rule via .htaccess in order to redirect requests from domain.tdl to www.domain.tdl.
This is approach works fine with my everyday php projects:



RewriteEngine On
RewriteBase /

# redirect all pages w/o www to www.
RewriteCond %HTTP_HOST !^www.domain.tdl$
RewriteRule ^(.*)$ http://www.domain.tdl/$1 [L,R=301]


However when i add this to our redmine/public/.htaccess it seems to redirect infinitely (resulting in a timeout/http 500 error).



I tried to look up forums/google for a solution but i only found thousands of contradictory opinions:



  • ruby on rails and .htaccess don't work together

  • ruby on rails and .htaccess DO work together

  • you have to edit your application controller

  • you have to edit your mongel config

  • and so forth...

Am I missing something? I'm not sure i want to edit my application controller and I'm quite certain I don't have access to any mongrel config (managed server hosting).










share|improve this question
























  • Take a look at the error log.

    – quanta
    Nov 7 '11 at 13:41











  • RewriteLog /tmp/rewrite.log and RewriteLogLevel 9 (which must be set in the server config) FTW!

    – Holger Just
    Nov 7 '11 at 23:01













1












1








1








I installed Redmine and so far everything runs smoothly.



Now i want to add a rewrite rule via .htaccess in order to redirect requests from domain.tdl to www.domain.tdl.
This is approach works fine with my everyday php projects:



RewriteEngine On
RewriteBase /

# redirect all pages w/o www to www.
RewriteCond %HTTP_HOST !^www.domain.tdl$
RewriteRule ^(.*)$ http://www.domain.tdl/$1 [L,R=301]


However when i add this to our redmine/public/.htaccess it seems to redirect infinitely (resulting in a timeout/http 500 error).



I tried to look up forums/google for a solution but i only found thousands of contradictory opinions:



  • ruby on rails and .htaccess don't work together

  • ruby on rails and .htaccess DO work together

  • you have to edit your application controller

  • you have to edit your mongel config

  • and so forth...

Am I missing something? I'm not sure i want to edit my application controller and I'm quite certain I don't have access to any mongrel config (managed server hosting).










share|improve this question
















I installed Redmine and so far everything runs smoothly.



Now i want to add a rewrite rule via .htaccess in order to redirect requests from domain.tdl to www.domain.tdl.
This is approach works fine with my everyday php projects:



RewriteEngine On
RewriteBase /

# redirect all pages w/o www to www.
RewriteCond %HTTP_HOST !^www.domain.tdl$
RewriteRule ^(.*)$ http://www.domain.tdl/$1 [L,R=301]


However when i add this to our redmine/public/.htaccess it seems to redirect infinitely (resulting in a timeout/http 500 error).



I tried to look up forums/google for a solution but i only found thousands of contradictory opinions:



  • ruby on rails and .htaccess don't work together

  • ruby on rails and .htaccess DO work together

  • you have to edit your application controller

  • you have to edit your mongel config

  • and so forth...

Am I missing something? I'm not sure i want to edit my application controller and I'm quite certain I don't have access to any mongrel config (managed server hosting).







ruby-on-rails rewrite redmine






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 '11 at 16:04







Paul Voss

















asked Nov 7 '11 at 12:05









Paul VossPaul Voss

1065




1065












  • Take a look at the error log.

    – quanta
    Nov 7 '11 at 13:41











  • RewriteLog /tmp/rewrite.log and RewriteLogLevel 9 (which must be set in the server config) FTW!

    – Holger Just
    Nov 7 '11 at 23:01

















  • Take a look at the error log.

    – quanta
    Nov 7 '11 at 13:41











  • RewriteLog /tmp/rewrite.log and RewriteLogLevel 9 (which must be set in the server config) FTW!

    – Holger Just
    Nov 7 '11 at 23:01
















Take a look at the error log.

– quanta
Nov 7 '11 at 13:41





Take a look at the error log.

– quanta
Nov 7 '11 at 13:41













RewriteLog /tmp/rewrite.log and RewriteLogLevel 9 (which must be set in the server config) FTW!

– Holger Just
Nov 7 '11 at 23:01





RewriteLog /tmp/rewrite.log and RewriteLogLevel 9 (which must be set in the server config) FTW!

– Holger Just
Nov 7 '11 at 23:01










1 Answer
1






active

oldest

votes


















0














It might seem obvious but double check for typos. If the RewriteCond and the RewriteRule don't have exactly the same string for the host then you will end up with infinite redirects. Since you have used placeholders here we can't spot that problem for you.



It's worth using 302 redirects while you are debugging. 301s are cachable and normal web browsers will continue using a 301 redirect they received long after you have changed it on the server. Command line tools like curl and wget don't do this sort of caching.



Do you have a reverse proxy? If so, the Host: header may not be the same on the back end as at the front end.



A timeout is not the same as a 500 error. A redirect loop is not the same as either of them. Try to track down exactly what the response is. Using something like curl -s --include http://www.domain.tdl/ | grep "^HTTP" should do the trick.






share|improve this answer

























  • Thank you for your suggestions. It was indeed a infinite redirection (Status 302). I narrowed the source of the problem down to the variable %HTTP_HOST not having the excepted value. It's not "domain.tdl" but something like "1.domain.tdl.anCUSTOMERID.webdav.something.something:81". Not yet sure if it's the "fault" of our hoster or a general problem with Apache Web Server + Phusion Passenger (since I'm a Ruby noob).

    – Paul Voss
    Nov 7 '11 at 15:07












  • This question seems related: stackoverflow.com/questions/1896321/… ... unfortunately i'm not allowed to edit the apache config. :/

    – Paul Voss
    Nov 8 '11 at 9:28











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f328462%2fproblems-with-htaccess-rewrite-and-ruby-on-rails-redmine%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














It might seem obvious but double check for typos. If the RewriteCond and the RewriteRule don't have exactly the same string for the host then you will end up with infinite redirects. Since you have used placeholders here we can't spot that problem for you.



It's worth using 302 redirects while you are debugging. 301s are cachable and normal web browsers will continue using a 301 redirect they received long after you have changed it on the server. Command line tools like curl and wget don't do this sort of caching.



Do you have a reverse proxy? If so, the Host: header may not be the same on the back end as at the front end.



A timeout is not the same as a 500 error. A redirect loop is not the same as either of them. Try to track down exactly what the response is. Using something like curl -s --include http://www.domain.tdl/ | grep "^HTTP" should do the trick.






share|improve this answer

























  • Thank you for your suggestions. It was indeed a infinite redirection (Status 302). I narrowed the source of the problem down to the variable %HTTP_HOST not having the excepted value. It's not "domain.tdl" but something like "1.domain.tdl.anCUSTOMERID.webdav.something.something:81". Not yet sure if it's the "fault" of our hoster or a general problem with Apache Web Server + Phusion Passenger (since I'm a Ruby noob).

    – Paul Voss
    Nov 7 '11 at 15:07












  • This question seems related: stackoverflow.com/questions/1896321/… ... unfortunately i'm not allowed to edit the apache config. :/

    – Paul Voss
    Nov 8 '11 at 9:28















0














It might seem obvious but double check for typos. If the RewriteCond and the RewriteRule don't have exactly the same string for the host then you will end up with infinite redirects. Since you have used placeholders here we can't spot that problem for you.



It's worth using 302 redirects while you are debugging. 301s are cachable and normal web browsers will continue using a 301 redirect they received long after you have changed it on the server. Command line tools like curl and wget don't do this sort of caching.



Do you have a reverse proxy? If so, the Host: header may not be the same on the back end as at the front end.



A timeout is not the same as a 500 error. A redirect loop is not the same as either of them. Try to track down exactly what the response is. Using something like curl -s --include http://www.domain.tdl/ | grep "^HTTP" should do the trick.






share|improve this answer

























  • Thank you for your suggestions. It was indeed a infinite redirection (Status 302). I narrowed the source of the problem down to the variable %HTTP_HOST not having the excepted value. It's not "domain.tdl" but something like "1.domain.tdl.anCUSTOMERID.webdav.something.something:81". Not yet sure if it's the "fault" of our hoster or a general problem with Apache Web Server + Phusion Passenger (since I'm a Ruby noob).

    – Paul Voss
    Nov 7 '11 at 15:07












  • This question seems related: stackoverflow.com/questions/1896321/… ... unfortunately i'm not allowed to edit the apache config. :/

    – Paul Voss
    Nov 8 '11 at 9:28













0












0








0







It might seem obvious but double check for typos. If the RewriteCond and the RewriteRule don't have exactly the same string for the host then you will end up with infinite redirects. Since you have used placeholders here we can't spot that problem for you.



It's worth using 302 redirects while you are debugging. 301s are cachable and normal web browsers will continue using a 301 redirect they received long after you have changed it on the server. Command line tools like curl and wget don't do this sort of caching.



Do you have a reverse proxy? If so, the Host: header may not be the same on the back end as at the front end.



A timeout is not the same as a 500 error. A redirect loop is not the same as either of them. Try to track down exactly what the response is. Using something like curl -s --include http://www.domain.tdl/ | grep "^HTTP" should do the trick.






share|improve this answer















It might seem obvious but double check for typos. If the RewriteCond and the RewriteRule don't have exactly the same string for the host then you will end up with infinite redirects. Since you have used placeholders here we can't spot that problem for you.



It's worth using 302 redirects while you are debugging. 301s are cachable and normal web browsers will continue using a 301 redirect they received long after you have changed it on the server. Command line tools like curl and wget don't do this sort of caching.



Do you have a reverse proxy? If so, the Host: header may not be the same on the back end as at the front end.



A timeout is not the same as a 500 error. A redirect loop is not the same as either of them. Try to track down exactly what the response is. Using something like curl -s --include http://www.domain.tdl/ | grep "^HTTP" should do the trick.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 7 '11 at 14:56

























answered Nov 7 '11 at 12:43









LadadadadaLadadadada

22.2k54981




22.2k54981












  • Thank you for your suggestions. It was indeed a infinite redirection (Status 302). I narrowed the source of the problem down to the variable %HTTP_HOST not having the excepted value. It's not "domain.tdl" but something like "1.domain.tdl.anCUSTOMERID.webdav.something.something:81". Not yet sure if it's the "fault" of our hoster or a general problem with Apache Web Server + Phusion Passenger (since I'm a Ruby noob).

    – Paul Voss
    Nov 7 '11 at 15:07












  • This question seems related: stackoverflow.com/questions/1896321/… ... unfortunately i'm not allowed to edit the apache config. :/

    – Paul Voss
    Nov 8 '11 at 9:28

















  • Thank you for your suggestions. It was indeed a infinite redirection (Status 302). I narrowed the source of the problem down to the variable %HTTP_HOST not having the excepted value. It's not "domain.tdl" but something like "1.domain.tdl.anCUSTOMERID.webdav.something.something:81". Not yet sure if it's the "fault" of our hoster or a general problem with Apache Web Server + Phusion Passenger (since I'm a Ruby noob).

    – Paul Voss
    Nov 7 '11 at 15:07












  • This question seems related: stackoverflow.com/questions/1896321/… ... unfortunately i'm not allowed to edit the apache config. :/

    – Paul Voss
    Nov 8 '11 at 9:28
















Thank you for your suggestions. It was indeed a infinite redirection (Status 302). I narrowed the source of the problem down to the variable %HTTP_HOST not having the excepted value. It's not "domain.tdl" but something like "1.domain.tdl.anCUSTOMERID.webdav.something.something:81". Not yet sure if it's the "fault" of our hoster or a general problem with Apache Web Server + Phusion Passenger (since I'm a Ruby noob).

– Paul Voss
Nov 7 '11 at 15:07






Thank you for your suggestions. It was indeed a infinite redirection (Status 302). I narrowed the source of the problem down to the variable %HTTP_HOST not having the excepted value. It's not "domain.tdl" but something like "1.domain.tdl.anCUSTOMERID.webdav.something.something:81". Not yet sure if it's the "fault" of our hoster or a general problem with Apache Web Server + Phusion Passenger (since I'm a Ruby noob).

– Paul Voss
Nov 7 '11 at 15:07














This question seems related: stackoverflow.com/questions/1896321/… ... unfortunately i'm not allowed to edit the apache config. :/

– Paul Voss
Nov 8 '11 at 9:28





This question seems related: stackoverflow.com/questions/1896321/… ... unfortunately i'm not allowed to edit the apache config. :/

– Paul Voss
Nov 8 '11 at 9:28

















draft saved

draft discarded
















































Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f328462%2fproblems-with-htaccess-rewrite-and-ruby-on-rails-redmine%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos