Forum: Ruby on Rails .htaccess rewrite

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
78afdba6236b562b3c0f582d69cd161a?d=identicon&s=25 Sav (Guest)
on 2008-10-07 01:29
(Received via mailing list)
can someone help me with an .htaccess rewrite?

i'm trying to convert all requests to "/?spot=8888" to be "/locations/
888".

thanks.
6aff10d3d9f43b6a0b6e206d0f5bb392?d=identicon&s=25 Gerson Minichiello (minichiello)
on 2008-10-07 03:01
(Received via mailing list)
Hi,

Try this .htaccess file:

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^\/locations\/(.*)$ /?spot=$1
78afdba6236b562b3c0f582d69cd161a?d=identicon&s=25 Sav (Guest)
on 2008-10-07 04:39
(Received via mailing list)
That didn't work (and appears to be backwards).  I tried the following
w/ no luck...

RewriteRule ^\/?spot=(.*)$ /locations/$1
RewriteRule ^\/?spot=(.*)$ /locations/$1 [R=301,L]
RewriteRule /?spot=(.*)$ /locations/$1 [R=301,L]

This is also for a subdomain under Rails...

http://m.domain.com/?spot=8888
to
http://m.domain.com/locations/8888



On Oct 6, 5:34 pm, Gerson Minichiello <gerson.minichie...@gmail.com>
589525f133e603e1f17af9b03176c000?d=identicon&s=25 Abhishek shukla (Guest)
on 2008-10-07 09:43
(Received via mailing list)
guys even my problem is somewhat related to the same as currently hosted
my
application on bluehost which is running on port 12004. so when every i
try
to access my site "http:///www.mydomain.com" its redirect me to "
http://mydomain.com:12004" so if some one guide me that will be very
helpful
thanks....

regards
abhishek
78afdba6236b562b3c0f582d69cd161a?d=identicon&s=25 Sav (Guest)
on 2008-10-07 17:08
(Received via mailing list)
@abhishek - you can catch all traffic on a port and redirect like this
(but beware of an infinite loop)...

RewriteCond '%{SERVER_PORT}"     "^12004$"
RewriteRule "^(.*)$"     "http://%{SERVER_NAME}$1" [R=301,L]


Anyone able to help me with a redirect from "/?spot=8888" to "/
locations/8888"?  Simple yet elusive :(
589525f133e603e1f17af9b03176c000?d=identicon&s=25 Abhishek shukla (Guest)
on 2008-10-07 17:34
(Received via mailing list)
Hey thanks sav but still no success...
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
RewriteCond '%{SERVER_PORT}"     "^12004$"
RewriteRule "^(.*)$" "http://%{SERVER_NAME}$1" [R=301,L]

This is my .htaccess setting and seriously no idea.... wat to do... new
in
deployment.
Note i don't have an root access.. the only file which i can editi s
.htaccess and other files from public folder........

Thanks sav if you can help me

regards
Abhishek Shukla
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2008-10-07 19:35
(Received via mailing list)
On Mon, Oct 6, 2008 at 7:30 PM, Sav <savarino@gmail.com> wrote:
>
> That didn't work (and appears to be backwards).  I tried the following
> w/ no luck...

You probably want to turn on/up rewrite logging for more information
on /why/ you're having "no luck", instead of guessing   :-)

Something like:

RewriteLog "/usr/local/apache-httpd-2.2.9/logs/rewrite.log"
RewriteLogLevel 3

See the httpd docs for more info.

HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
589525f133e603e1f17af9b03176c000?d=identicon&s=25 Abhishek shukla (Guest)
on 2008-10-07 20:40
(Received via mailing list)
Hey Hassan,
Thanks for reply the main issue is that i don't have an access to apache
folder currently my application running on  Bluehost with a dedicated IP
address. And even i am not able to access rewrite.log file as well :( so
that is why my is screwed up.. So please guys help me.....


Regards
Abhishek shukla

On Tue, Oct 7, 2008 at 11:04 PM, Hassan Schroeder <
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2008-10-07 22:07
(Received via mailing list)
On Tue, Oct 7, 2008 at 11:39 AM, Abhishek shukla <betterabhi@gmail.com>
wrote:

> Thanks for reply the main issue is that i don't have an access to apache
> folder currently my application running on  Bluehost with a dedicated IP
> address. And even i am not able to access rewrite.log file as well

You should be able to set this up through .htaccess with logging
set to go to a directory you have write permissions to.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
This topic is locked and can not be replied to.