Title: redirect all urls from http to https except one url
Last modified: September 1, 2016

---

# redirect all urls from http to https except one url

 *  [Lois](https://wordpress.org/support/users/loiscr/)
 * (@loiscr)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/redirect-all-urls-from-http-to-https-except-one-url/)
 * Hello! I have in my htaccess the following code to redirect all http urls to 
   https:
 * RewriteCond %{HTTPS} !on
    RewriteRule (.*) [https://%](https://%){HTTP_HOST}%{
   REQUEST_URI} [R=301,L]
 * This works great, but now I need to allow to access by http only to one specific
   url: /feed/products/
 * So I edited the code to this
 * RewriteCond %{HTTPS} !on
    RewriteCond %{REQUEST_URI} !^/feed/products/ RewriteRule(.*)
   [https://%](https://%){HTTP_HOST}%{REQUEST_URI} [R=301,L]
 * The problem is what when I enter [http://mydomain.com/feed/products/](http://mydomain.com/feed/products/)
   instead of keep in [http://mydomain.com/feed/products/](http://mydomain.com/feed/products/)
   that is what I expected, it redirects to the home page.
 * What is the problem? I don´t know much about htacces. Thank you!!!

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

 *  [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/redirect-all-urls-from-http-to-https-except-one-url/#post-7482413)
 * You can try something like this, but it will probably not work if your WordPress
   General Settings are like the settings shown below. If you have mixed URL’s on
   your website then most likely a redirect loop problem will occur. You cannot 
   use both http and https URL’s in the Source Code of a website page. All URL’s
   in a page that is http must be http, all URL’s in a page that is https must be
   https.
 *     ```
       WordPress General Settings:
       WordPress Address (URL) https://www.your-domain-name.com
       Site Address (URL)      https://www.your-domain-name.com
       ```
   
 * Give this a try, but most likely it will not work.
 *     ```
       # WP REWRITE LOOP START
       # Rewrite|Redirect http to https|SSL
       RewriteEngine On
       RewriteBase /
       RewriteRule ^feed/products/ http://example.com/feed/products/ [R,L]
       RewriteCond %{HTTPS} !=on
       RewriteCond %{SERVER_PORT} ^80
       RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
       RewriteRule ^index\.php$ - [L]
   
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       # WP REWRITE LOOP END
       ```
   
 *  Thread Starter [Lois](https://wordpress.org/support/users/loiscr/)
 * (@loiscr)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/redirect-all-urls-from-http-to-https-except-one-url/#post-7482433)
 * Thanks! I tried your code but it didn´t work.
 * If this works:
    RewriteCond %{HTTPS} !on RewriteRule (.*) [https://%](https://%){
   HTTP_HOST}%{REQUEST_URI} [R=301,L]
 * I don´t understand why this not works:
    RewriteCond %{HTTPS} !on RewriteCond %{
   REQUEST_URI} !^/feed/products/ RewriteRule (.*) [https://%](https://%){HTTP_HOST}%{
   REQUEST_URI} [R=301,L]
 * I have only added a exception. Not changes in the rewrite rule. Its apparently
   impossible. Any ideas?

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

The topic ‘redirect all urls from http to https except one url’ is closed to new
replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Lois](https://wordpress.org/support/users/loiscr/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/redirect-all-urls-from-http-to-https-except-one-url/#post-7482433)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
