# URL rewrite to force 'www' and '.html'

**URL:** <https://www.ruby-forum.com/t/url-rewrite-to-force-www-and-html/158025>\
**Category:** Rails\
**Created:** [January 18, 2009, 3:28am UTC](https://www.ruby-forum.com/t/url-rewrite-to-force-www-and-html/158025 "2009-01-18T03:28:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adeel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f4b2a3/32.png) [@adeel](https://www.ruby-forum.com/u/adeel)\
**Post date:** [January 18, 2009, 3:28am UTC](https://www.ruby-forum.com/t/url-rewrite-to-force-www-and-html/158025/1 "2009-01-18T03:28:32Z")

</div>

For SEO, I need to force the URL to contain ‘www’ so my app always  
appears in the browser as [www.example.com](http://www.example.com) and not ‘[example.com](http://example.com)’. I  
also need the filename (ex. index.html) to appear completely, and not  
be hidden.

Can someone give us some pointers on how to set this up? I understand  
the first case involves .htaccess but I’m nervous about modifying that  
without good guidance.

Thanks.

---

<div class="post-metadata">

**Author:** ![adeel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f4b2a3/32.png) [@adeel](https://www.ruby-forum.com/u/adeel)\
**Post date:** [January 18, 2009, 2:10pm UTC](https://www.ruby-forum.com/t/url-rewrite-to-force-www-and-html/158025/2 "2009-01-18T14:10:18Z")

</div>

adeel wrote:

> For SEO, I need to force the URL to contain ï¿½wwwï¿½ so my app always  
> appears in the browser as [www.example.com](http://www.example.com) and not ï¿½example.comï¿½.  
> For this you have to set a rewrite rule in Nginx or Apache. There is  
> plenty doc on the net.

I never heard that appending .html to URL will improve SE ranking.

–  
Video tutorials for distance learners in french: [http://www.digiprof.fr](http://www.digiprof.fr)
