Easy RoR & mod_rewrite...

travisbell

Well-Known Member
#1
Hey guys,

I have an easy RoR template site setup and would like to apply a
mod_rewrite rule to redirect some urls to other pages on the site.

I would like to use the .htacess to do this since the site isn't going
to be deployed on a LiteSpeed server so I can't use the rewrite tools
built into the admin interface.

What do I need to enable/change in the LS admin to start using
mod_rewrite in my .htaccess?

Thanks!
 

travisbell

Well-Known Member
#3
Hey.

I have enabled all of the .htaccess options on the server AND vhost level, including the Rails context but I can't get this to go. I have an empty .htaccess with only, the following 2 lines in it:

Code:
RewriteCond %{REQUEST_URI} ^/projects/current-urban/kensington/
RewriteRule ^/projects/current-urban/kensington/ /projects/current-urban/kensington/overview$1 [R=301,L]
This should redirect requests for /projects/current-urban/kensington/ to /projects/current-urban/kensington/overview/ no?

Is there anything else that needs to be enabled?
 

travisbell

Well-Known Member
#5
Hello,

I did this but to still no avail.

Would it matter if I am running the server (RoR) in development mode? I can't imagine so...

Basically, it's like LS is ignoring the .htaccess completely and I am not sure why.

Thanks for any moire help you can give!

Cheers,
 

mistwang

LiteSpeed Staff
#6
Please enable debug logging, see if the .htaccess has been loaded when the directory was accessed by the first.

Enable the rewrite logging for the vhost, see if the rewrite rule is really what you want.
 

mistwang

LiteSpeed Staff
#7
I think your rewrite will not work in a .htaccess, as the rewrite base has been cut off first.

if the .htaccess file is under "projects" directory, you need to use a rewrite rule like, turn on rewrite log, you will get some ideas.


RewriteRule ^current-urban/kensington/(.*) /projects/current-urban/kensington/overview$1 [R=301,L]
 
Top