# .htaccess mod\_rewrite woes

**URL:** <https://www.ruby-forum.com/t/htaccess-mod-rewrite-woes/143196>\
**Category:** Radiant CMS\
**Created:** [July 16, 2008, 7:06am UTC](https://www.ruby-forum.com/t/htaccess-mod-rewrite-woes/143196 "2008-07-16T07:06:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubella](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6a8cbe/32.png) [@rubella](https://www.ruby-forum.com/u/rubella)\
**Post date:** [July 16, 2008, 7:06am UTC](https://www.ruby-forum.com/t/htaccess-mod-rewrite-woes/143196/1 "2008-07-16T07:06:36Z")

</div>

Hi All,

I just cane$B!Ge(Bt seem to get redirects going in  
Radiante$B!Ge(Bs .htaccess. Can someone enlighten me?

In the default .htaccess file after RewriteEngine On (shich should be  
after the Options at the top btw) I tried these vavriants

```
 RewriteRule from.html to.html

 RewriteRule from.html http://domain/to.html [R=301,L]

 RewriteCond %{REQUEST_URI} ^/from\.html
 RewriteRule .* http://domain.com/to.html [R=301,L]

```

which all work on another domain on this server. Nothing happens. I  
also tried adding the example e$B!Fe(Btell Rails to ignore thise$B!Ge(B  
rules, but Ie$B!Ge(Bm probably doing it wrong.

```
 RewriteRule from.html to.html
 RewriteCond %{REQUEST_URI} ^/to\.html
 RewriteRule .* - [L]

```

Any ideas? I actually want to redirect one file and map it to a  
subdomain (eg [http://domain.com/test](http://domain.com/test) to [http://test.domain.com/](http://test.domain.com/)), but  
I cane$B!Ge(Bt even get simple file redirection going. Finally  
Ie$B!Ge(Bd like to know if ite$B!Ge(Bs possible to use .htaccess to  
generate canonical URLs. Specifically I want [http://domain.com/](http://domain.com/) to  
redirect to [http://www.domain.com/](http://www.domain.com/), and all trailing slashes to be  
stripped eg [http://www.domain.com/news/](http://www.domain.com/news/) to [http://www.domain.com/news](http://www.domain.com/news)

Thanks for your time

peace - oli

PS This is using Radiant 0.6.6, the last version that supports the  
gettext interface localization plugin Ie$B!Ge(Bm using. Btw what needs  
to be done to resurrect jargone$B!Ge(Bs gibberish i18n support?  
I cane$B!Ge(Bt even get jargon to install atm

---

<div class="post-metadata">

**Author:** ![rubella](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/6a8cbe/32.png) [@rubella](https://www.ruby-forum.com/u/rubella)\
**Post date:** [July 16, 2008, 7:53pm UTC](https://www.ruby-forum.com/t/htaccess-mod-rewrite-woes/143196/2 "2008-07-16T19:53:44Z")

</div>

Oli S. wrote:

> I just cane$B!Ge(Bt seem to get redirects going in  
> Radiante$B!Ge(Bs .htaccess. Can someone enlighten me?

Could it be that the Apache VirtualHost for the site isn’t allowing  
.htaccess overrides? Your httpd.conf file should have a VirtualHost  
looking something like this:

\<VirtualHost \*:80\>  
ServerName [PROJECT.com](http://PROJECT.com)  
DocumentRoot /Users/dave/Sites/PROJECT  
\<Directory “/Users/dave/Sites/PROJECT.com”\>  
### ensure mod-rewrite by turning off MultiViews and  
### allowing .htaccess override to set rewrite rules  
Options FollowSymLinks -Indexes -MultiViews  
AllowOverride All  
Order allow,deny  
Allow from all

- Dave
