Welcome Guest, Not a member yet? Register   Sign In
htaccess help please
#1

[eluser]TomRPS[/eluser]
I have redmine installed and it is accessed by mydomain.com:12001 and I need to redirect this to mydomain.com/support. This is a ruby app on a cpanel server and redirects made through cpanel do not work. I assume because of my htaccess file. Can someone tell me what I need to add so I can get this to work?
Current htaccess:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(gridsearch) - [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

Thanks,
Tom
#2

[eluser]bubbafoley[/eluser]
Just so I understand... if a user goes to mydomain.com/support you want it to work the same as if they went to mydomain:12001?

I don't think you can do this with just an htaccess file. You are probably going to have to set up a proxy server
http://ask.metafilter.com/44548/Can-apac...g-the-port
#3

[eluser]TomRPS[/eluser]
Yes that is what I am trying to accomplish - http://mydomain.com:12001 -> http://mydomain.com/support. Redmine is a Ruby on Rails application and Cpanel has the option to redirect ROR apps to another URL (same domain of course). This works fine on other sites I have but on the one with codeigniter it will not work. I guess what I really need is a rule in the htaccess file that will ignore (not redirect) any requests going to http://mydomain.com/support. Maybe then the redirect set up within cpanel will work. Does that make sense?
#4

[eluser]bubbafoley[/eluser]
try adding

Code:
RewriteCond %{REQUEST_URI} !^/support(.*)$

to your rewrite rule. so you would having something like

Code:
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

RewriteRule ^(gridsearch) - [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/support(.*)$
RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
#5

[eluser]TomRPS[/eluser]
OK, I got this working now. I noticed that the cpanel redirect is in fact a edit to the htaccess file. Along with the change from above it works now.

Thanks for your help!

Tom

For anyone finding this thread with the same problem (Codeigniter and Redmine on same site)

htaccess -
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(gridsearch) - [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/support(.*)$
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^support(.*) "http\:\/\/127\.0\.0\.1\:12001\/$1" [P,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>

Redmine needs base url set at bottom of config/environment.rb
Code:
Redmine::Utils::relative_url_root = "/support"




Theme © iAndrew 2016 - Forum software by © MyBB