My Ruby on Rails application only works if the address contains the port
- by True Soft
I have a Ruby on Rails application that works ok on my notebook ( http://localhost:3000/ )
I uploaded it on my hosting server,
created with CPanel X an application, the URL is http://example.com:12007/
created a rewrite from http://example.com/ to http://example.com:12007/,
and started it.
If I write in my browser http://example.com:12007/ or http://www.example.com:12007/ all the pages work as expected. But if I write http://example.com/ or http://www.example.com/ the first page is displayed, but without any css or images (just like it wouldn't find them). I can see all the text (even the text from my MySQL database), but with no format. And if I click on any link, I get a error page like this:
Not Found
The requested URL /some_controller was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
What should I do to make my website work without writing the port in the address bar?
The content of my /public_html/.htaccess file is
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^/?$ "http\:\/\/127\.0\.0\.1\:12007%{REQUEST_URI}" [P,QSA,L]
which I guess was generated by CPanel Rewrites.