Title: Htaccess help required
Last modified: August 31, 2016

---

# Htaccess help required

 *  [Jithin Johny Geogre](https://wordpress.org/support/users/jithin-johny-geogre/)
 * (@jithin-johny-geogre)
 * [10 years ago](https://wordpress.org/support/topic/htaccess-help-required/)
 * Hi,
 * Can someone please provide me htaccess code for the following purpose.
 * 1. Redirect non www requests to www version
    2. http requests to https
 * I have already installed wild card ssl certificate on my domain.
 * Thank in advance.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Davood Denavi](https://wordpress.org/support/users/binarywc/)
 * (@binarywc)
 * [10 years ago](https://wordpress.org/support/topic/htaccess-help-required/#post-7429064)
 * Add the following to your htaccess file! _Remember to edit it for your domain
   name. _
 *     ```
       # Force url with WWW
       RewriteBase /
       RewriteCond %{HTTP_HOST} !^site.com$ [NC]
       RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301]
   
       # Force https
       RewriteCond %{HTTP_HOST} ^site\.com [NC]
       RewriteCond %{SERVER_PORT} 80
       RewriteRule ^(.*)$ https://www.site.com/$1 [R,L]
       ```
   
 * Hope this helps! Let us know if you have any problems!
 *  Thread Starter [Jithin Johny Geogre](https://wordpress.org/support/users/jithin-johny-geogre/)
 * (@jithin-johny-geogre)
 * [10 years ago](https://wordpress.org/support/topic/htaccess-help-required/#post-7429091)
 * Thank for the reply. When I applied the code on my htaccess file, and reloaded
   my home page, I am getting the following error code.
 * > The [http://www.site.com](http://www.site.com) page isn’t working
   > [http://www.site.com](http://www.site.com) redirected you too many times.
   >  
   > Try: Reloading the page Clearing your cookies ERR_TOO_MANY_REDIRECTS
 *  [Davood Denavi](https://wordpress.org/support/users/binarywc/)
 * (@binarywc)
 * [10 years ago](https://wordpress.org/support/topic/htaccess-help-required/#post-7429165)
 * Please read my message again. it is not as simple as just copying that code. 
   Your url is not site.com. you need to change all instances of site.com to have
   your url.
 * For instance, my url is dehnavi.net so my code would look like this
 *     ```
       # Force url with WWW
       RewriteBase /
       RewriteCond %{HTTP_HOST} !^dehnavi.net$ [NC]
       RewriteRule ^(.*)$ http://www.dehnavi.net/$1 [L,R=301]
   
       # Force https
       RewriteCond %{HTTP_HOST} ^dehnavi\.net [NC]
       RewriteCond %{SERVER_PORT} 80
       RewriteRule ^(.*)$ https://www.dehnavi.net/$1 [R,L]
       ```
   
 *  [Davood Denavi](https://wordpress.org/support/users/binarywc/)
 * (@binarywc)
 * [10 years ago](https://wordpress.org/support/topic/htaccess-help-required/#post-7429166)
 * **_Please note: I do not have a site up at that address but that is the code 
   I would use if I wanted to do what you are trying to do._**

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Htaccess help required’ is closed to new replies.

## Tags

 * [htaccess](https://wordpress.org/support/topic-tag/htaccess/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Davood Denavi](https://wordpress.org/support/users/binarywc/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/htaccess-help-required/#post-7429166)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
